public class SchemaUtils
extends java.lang.Object
Constructor and Description |
---|
SchemaUtils() |
Modifier and Type | Method and Description |
---|---|
static Schema |
mergeWideningNullable(Schema schema1,
Schema schema2)
Given two schema that have matching types, return a nullable-widened schema.
|
static <InputT,BaseT> |
toLogicalBaseType(Schema.LogicalType<InputT,BaseT> logicalType,
InputT inputType)
Returns the base type given a logical type and the input type.
|
static <BaseT,InputT> |
toLogicalInputType(Schema.LogicalType<InputT,BaseT> logicalType,
BaseT baseType)
Returns the input type given a logical type and the base type.
|
public static Schema mergeWideningNullable(Schema schema1, Schema schema2)
The schemas must have matching types, except for field names which can differ. The returned schema will contain the field names in the first schema. All field types will be nullable if the corresponding field type is nullable in either of the input schemas.
public static <InputT,BaseT> BaseT toLogicalBaseType(Schema.LogicalType<InputT,BaseT> logicalType, InputT inputType)
This function can be used to handle logical types without knowing InputT or BaseT.
public static <BaseT,InputT> InputT toLogicalInputType(Schema.LogicalType<InputT,BaseT> logicalType, BaseT baseType)
This function can be used to handle logical types without knowing InputT or BaseT.