Interface Schema.LogicalType<InputT,BaseT>

Type Parameters:
InputT - The Java type used to set the type when using Row.Builder.addValue(java.lang.Object).
BaseT - The Java type for the underlying storage.
All Superinterfaces:
Serializable
All Known Implementing Classes:
CalciteUtils.TimeWithLocalTzType, Date, DateTime, EnumerationType, FixedBytes, FixedPrecisionNumeric, FixedString, MicrosInstant, NanosDuration, NanosInstant, OneOfType, PassThroughLogicalType, ProtoSchemaLogicalTypes.Fixed32, ProtoSchemaLogicalTypes.Fixed64, ProtoSchemaLogicalTypes.SFixed32, ProtoSchemaLogicalTypes.SFixed64, ProtoSchemaLogicalTypes.SInt32, ProtoSchemaLogicalTypes.SInt64, ProtoSchemaLogicalTypes.UInt32, ProtoSchemaLogicalTypes.UInt64, PythonCallable, SbeLogicalTypes.LocalMktDate, SbeLogicalTypes.TZTimeOnly, SbeLogicalTypes.TZTimestamp, SbeLogicalTypes.Uint16, SbeLogicalTypes.Uint32, SbeLogicalTypes.Uint64, SbeLogicalTypes.Uint8, SbeLogicalTypes.UTCDateOnly, SbeLogicalTypes.UTCTimeOnly, SbeLogicalTypes.UTCTimestamp, SchemaLogicalType, Time, UnknownLogicalType, UuidLogicalType, VariableBytes, VariableString
Enclosing class:
Schema

public static interface Schema.LogicalType<InputT,BaseT> extends Serializable
A LogicalType allows users to define a custom schema type.

A LogicalType is a way to define a new type that can be stored in a schema field using an underlying FieldType as storage. A LogicalType must specify a base FieldType used to store the data by overriding the getBaseType() method. Usually the FieldType returned will be one of the standard ones implemented by Schema. It is legal to return another LogicalType, but the storage types must eventually resolve to one of the standard Schema types; it is not allowed to have LogicalTypes reference each other recursively via getBaseType. The toBaseType(InputT) and toInputType(BaseT) should convert back and forth between the Java type for the LogicalType (InputT) and the Java type appropriate for the underlying base type (BaseT). Note for nullable types, null checking is always done externally. toBaseType(InputT) and toInputType(BaseT) may assume their inputs are never null.

getIdentifier() must define a globally unique identifier for this LogicalType. A LogicalType can optionally provide an identifying argument as well using getArgument(). An example is a LogicalType that represents a fixed-size byte array. The identifier "FixedBytes" uniquely identifies this LogicalType (or specifically, this class of LogicalTypes), while the argument returned will be the length of the fixed-size byte array. The combination of getIdentifier() and getArgument() must completely identify a LogicalType.

A LogicalType can be added to a schema using Schema.Builder.addLogicalTypeField(java.lang.String, org.apache.beam.sdk.schemas.Schema.LogicalType<InputT, BaseT>).