@PublicEvolving public class SchemaMergingUtils extends Object
Schemas and DataTypes. Prefer using this over SchemaUtils to get consistent schema merging behaviors.| 构造器和说明 |
|---|
SchemaMergingUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static Object[] |
coerceRow(String timezone,
Schema currentSchema,
Schema upcomingSchema,
List<Object> upcomingRow)
Coercing
upcomingRow with upcomingTypes schema into currentTypes
schema. |
static Object[] |
coerceRow(String timezone,
Schema currentSchema,
Schema upcomingSchema,
List<Object> upcomingRow,
boolean toleranceMode)
Coercing
upcomingRow with upcomingTypes schema into currentTypes
schema. |
static Schema |
getCommonSchema(List<Schema> schemas)
Merge compatible schemas.
|
static Schema |
getLeastCommonSchema(Schema currentSchema,
Schema upcomingSchema)
Try to merge
upcomingSchema into currentSchema by performing lenient schema
changes. |
static int |
getNumericPrecision(DataType dataType) |
static List<SchemaChangeEvent> |
getSchemaDifference(TableId tableId,
Schema beforeSchema,
Schema afterSchema)
Generating what schema change events we need to do by converting compatible
beforeSchema to afterSchema. |
static boolean |
isSchemaCompatible(Schema currentSchema,
Schema upcomingSchema)
Checking if given
upcomingSchema could be fit into currently known currentSchema. |
public static boolean isSchemaCompatible(@Nullable Schema currentSchema, Schema upcomingSchema)
upcomingSchema could be fit into currently known currentSchema. Current schema could be null (as the cold opening state, and in this case it
always returns false) but the upcoming schema should never be null. public static Schema getLeastCommonSchema(@Nullable Schema currentSchema, Schema upcomingSchema)
upcomingSchema into currentSchema by performing lenient schema
changes. Returns a wider schema that could both of them.public static Schema getCommonSchema(List<Schema> schemas)
public static List<SchemaChangeEvent> getSchemaDifference(TableId tableId, @Nullable Schema beforeSchema, Schema afterSchema)
beforeSchema to afterSchema.public static Object[] coerceRow(String timezone, Schema currentSchema, Schema upcomingSchema, List<Object> upcomingRow)
upcomingRow with upcomingTypes schema into currentTypes
schema. Invoking this method implicitly assumes that isSchemaCompatible(currentSchema,
upcomingSchema) returns true. Otherwise, some upstream records might be lost.public static Object[] coerceRow(String timezone, Schema currentSchema, Schema upcomingSchema, List<Object> upcomingRow, boolean toleranceMode)
upcomingRow with upcomingTypes schema into currentTypes
schema. Invoking this method implicitly assumes that isSchemaCompatible(currentSchema,
upcomingSchema) returns true. Otherwise, some upstream records might be lost.@VisibleForTesting public static int getNumericPrecision(DataType dataType)
Copyright © 2025 The Apache Software Foundation. All rights reserved.