T
- the type parameter for the HealthcareIOError
public class HealthcareIOErrorToTableRow<T> extends java.lang.Object implements SerializableFunction<HealthcareIOError<T>,TableRow>
HealthcareIOError
s to BigQuery TableRow
s.
This can be used with BigQueryIO.Write#withSchema(TableSchema)
by defining a dead
letter table schema
...
PCollection<HealthcareIOError<String>> errors = ...;
TableSchema deadLetterSchema = new TableSchema();
deadLetterSchema.setFields(HealthcareIOErrorToTableRow.TABLE_FIELD_SCHEMAS);
TimePartitioning deadLetterPartitioning = new TimeParitioning();
deadLetterPartitioning.setField(HealthcareIOErrorToTableRow.TIMESTAMP_FIELD_NAME);
errors.apply(
BigQueryIO.write()
.to(options.getDeadLetterTable())
.withFormatFunction(new HealthcareIOErrorToTableRow())
.withSchema(deadLetterSchema)
.withTimePartitioning(deadLetterPartitioning)
);
***
Modifier and Type | Field and Description |
---|---|
static java.util.List<TableFieldSchema> |
TABLE_FIELD_SCHEMAS |
static java.lang.String |
TIMESTAMP_FIELD_NAME |
Constructor and Description |
---|
HealthcareIOErrorToTableRow() |
Modifier and Type | Method and Description |
---|---|
TableRow |
apply(HealthcareIOError<T> err)
Returns the result of invoking this function on the given input.
|
public static final java.lang.String TIMESTAMP_FIELD_NAME
public static final java.util.List<TableFieldSchema> TABLE_FIELD_SCHEMAS
public TableRow apply(HealthcareIOError<T> err)
SerializableFunction
apply
in interface ProcessFunction<HealthcareIOError<T>,TableRow>
apply
in interface SerializableFunction<HealthcareIOError<T>,TableRow>