public class AvroSchemaEvolutionUtils extends Object
| Constructor and Description |
|---|
AvroSchemaEvolutionUtils() |
| Modifier and Type | Method and Description |
|---|---|
static InternalSchema |
reconcileSchema(org.apache.avro.Schema incomingSchema,
InternalSchema oldTableSchema,
boolean makeMissingFieldsNullable)
Support reconcile from a new avroSchema.
|
static org.apache.avro.Schema |
reconcileSchema(org.apache.avro.Schema incomingSchema,
org.apache.avro.Schema oldTableSchema,
boolean makeMissingFieldsNullable) |
static org.apache.avro.Schema |
reconcileSchemaRequirements(org.apache.avro.Schema sourceSchema,
org.apache.avro.Schema targetSchema,
boolean shouldReorderColumns)
Reconciles nullability and datatype requirements b/w
source and target schemas,
by adjusting these of the source schema to be in-line with the ones of the
target one. |
public static InternalSchema reconcileSchema(org.apache.avro.Schema incomingSchema, InternalSchema oldTableSchema, boolean makeMissingFieldsNullable)
incomingSchema - implicitly evolution of avro when hoodie write operationoldTableSchema - old internalSchemamakeMissingFieldsNullable - if true, fields missing from the incoming schema when compared to the oldTableSchema will become
nullable in the result. Otherwise, no updates will be made to those fields.public static org.apache.avro.Schema reconcileSchema(org.apache.avro.Schema incomingSchema,
org.apache.avro.Schema oldTableSchema,
boolean makeMissingFieldsNullable)
public static org.apache.avro.Schema reconcileSchemaRequirements(org.apache.avro.Schema sourceSchema,
org.apache.avro.Schema targetSchema,
boolean shouldReorderColumns)
source and target schemas,
by adjusting these of the source schema to be in-line with the ones of the
target one. Source is considered to be new incoming schema, while target could refer to prev table schema.
For example,
if colA in source is non-nullable, but is nullable in target, output schema will have colA as nullable.
if "hoodie.datasource.write.new.columns.nullable" is set to true and if colB is not present in source, but
is present in target, output schema will have colB as nullable.
if colC has different data type in source schema compared to target schema and if its promotable, (say source is int,
and target is long and since int can be promoted to long), colC will be long data type in output schema.sourceSchema - source schema that needs reconciliationtargetSchema - target schema that source schema will be reconciled againstsource one) that has nullability constraints and datatypes reconciledCopyright © 2024 The Apache Software Foundation. All rights reserved.