Class SchemaUpdateOptions
- All Implemented Interfaces:
Serializable
When the serializer's schema (from BigQueryProtoSerializationSchema.getTableSchema(io.github.flink.gcp.connector.bigquery.sink.TableDestination))
evolves past the destination table's schema, the sink can update the table itself via the
BigQuery API before continuing to write. The update is a union: existing table fields
are never dropped or reordered, new fields are appended, and field type changes are always
rejected. What the union may change is gated by these flags:
SchemaUpdateOptions.Builder.allowNewFields()— serializer fields missing from the table are appended. BigQuery cannot addREQUIREDcolumns to an existing table, so new fields are always added asNULLABLEeven when the serializer declares themREQUIRED.SchemaUpdateOptions.Builder.allowFieldRelaxation()— a table field declaredREQUIREDis relaxed toNULLABLEwhen the serializer does not declare itREQUIRED.REPEATEDfields are never changed.
Both flags default to off, in which case the sink never modifies table schemas (schema changes
made externally — for example via DDL — are still picked up reactively). Enabling updates
requires the bigquery.tables.get and bigquery.tables.update permissions.
Schema unionization is deliberately opt-in: BigQuery columns can never be dropped again, so a single malformed record shipping an unexpected field could otherwise poison a table permanently.
Instances are immutable and serializable. Use defaults() to keep updates disabled.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaUpdateOptions.Builderbuilder()Creates a newSchemaUpdateOptions.Builder.static SchemaUpdateOptionsdefaults()Returns options with connector-driven schema updates disabled.booleaninthashCode()booleanReturns whetherREQUIREDtable fields may be relaxed toNULLABLE.booleanReturns whether missing serializer fields may be appended to the table.booleanReturns whether any connector-driven schema update is enabled.toString()
-
Method Details
-
defaults
Returns options with connector-driven schema updates disabled. -
builder
Creates a newSchemaUpdateOptions.Builder.- Returns:
- a new builder
-
isAllowNewFields
public boolean isAllowNewFields()Returns whether missing serializer fields may be appended to the table. -
isAllowFieldRelaxation
public boolean isAllowFieldRelaxation()Returns whetherREQUIREDtable fields may be relaxed toNULLABLE. -
isEnabled
public boolean isEnabled()Returns whether any connector-driven schema update is enabled. -
equals
-
hashCode
public int hashCode() -
toString
-