Package org.apache.beam.sdk.schemas
Class SchemaUtils
java.lang.Object
org.apache.beam.sdk.schemas.SchemaUtils
A set of utility functions for schemas.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Schema
mergeWideningNullable
(Schema schema1, Schema schema2) Given two schema that have matching types, return a nullable-widened schema.static <InputT,
BaseT>
BaseTtoLogicalBaseType
(Schema.LogicalType<InputT, BaseT> logicalType, InputT inputType) Returns the base type given a logical type and the input type.static <BaseT,
InputT>
InputTtoLogicalInputType
(Schema.LogicalType<InputT, BaseT> logicalType, BaseT baseType) Returns the input type given a logical type and the base type.
-
Constructor Details
-
SchemaUtils
public SchemaUtils()
-
-
Method Details
-
mergeWideningNullable
Given two schema that have matching types, return a nullable-widened schema.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.
-
toLogicalBaseType
public static <InputT,BaseT> BaseT toLogicalBaseType(Schema.LogicalType<InputT, BaseT> logicalType, InputT inputType) Returns the base type given a logical type and the input type.This function can be used to handle logical types without knowing InputT or BaseT.
-
toLogicalInputType
public static <BaseT,InputT> InputT toLogicalInputType(Schema.LogicalType<InputT, BaseT> logicalType, BaseT baseType) Returns the input type given a logical type and the base type.This function can be used to handle logical types without knowing InputT or BaseT.
-