Package org.apache.beam.sdk.schemas
Class Schema.FieldType
- java.lang.Object
-
- org.apache.beam.sdk.schemas.Schema.FieldType
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- Schema
@Immutable public abstract static class Schema.FieldType extends java.lang.Object implements java.io.Serializable
A descriptor of a single field type. This is a recursive descriptor, as nested types are allowed.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static Schema.FieldType
BOOLEAN
The type of boolean fields.static Schema.FieldType
BYTE
The type of byte fields.static Schema.FieldType
BYTES
The type of bytes fields.static Schema.FieldType
DATETIME
The type of datetime fields.static Schema.FieldType
DECIMAL
The type of decimal fields.static Schema.FieldType
DOUBLE
The type of double fields.static Schema.FieldType
FLOAT
The type of float fields.static Schema.FieldType
INT16
The type of int16 fields.static Schema.FieldType
INT32
The type of int32 fields.static Schema.FieldType
INT64
The type of int64 fields.static Schema.FieldType
STRING
The type of string fields.
-
Constructor Summary
Constructors Constructor Description FieldType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static Schema.FieldType
array(Schema.FieldType elementType)
Create an array type for the given field type.static Schema.FieldType
array(Schema.FieldType elementType, boolean nullable)
Deprecated.Set the nullability on the elementType insteadboolean
equals(@Nullable java.lang.Object o)
boolean
equivalent(Schema.FieldType other, Schema.EquivalenceNullablePolicy nullablePolicy)
Check whether two types are equivalent.static org.apache.beam.sdk.schemas.Schema.FieldType.Builder
forTypeName(Schema.TypeName typeName)
java.util.Map<java.lang.String,byte[]>
getAllMetadata()
Deprecated.use schema options instead.abstract @Nullable Schema.FieldType
getCollectionElementType()
abstract @Nullable Schema.LogicalType
getLogicalType()
<LogicalTypeT extends Schema.LogicalType>
LogicalTypeTgetLogicalType(java.lang.Class<LogicalTypeT> logicalTypeClass)
Helper function for retrieving the concrete logical type subclass.abstract @Nullable Schema.FieldType
getMapKeyType()
abstract @Nullable Schema.FieldType
getMapValueType()
byte @Nullable []
getMetadata(java.lang.String key)
Deprecated.use schema options instead.java.lang.String
getMetadataString(java.lang.String key)
Deprecated.use schema options instead.abstract java.lang.Boolean
getNullable()
abstract @Nullable Schema
getRowSchema()
abstract Schema.TypeName
getTypeName()
int
hashCode()
boolean
isLogicalType(java.lang.String logicalTypeIdentifier)
static Schema.FieldType
iterable(Schema.FieldType elementType)
static <InputT,BaseT>
Schema.FieldTypelogicalType(Schema.LogicalType<InputT,BaseT> logicalType)
Creates a logical type based on a primitive field type.static Schema.FieldType
map(Schema.FieldType keyType, Schema.FieldType valueType)
Create a map type for the given key and value types.static Schema.FieldType
map(Schema.FieldType keyType, Schema.FieldType valueType, boolean valueTypeNullable)
Deprecated.Set the nullability on the valueType insteadstatic Schema.FieldType
of(Schema.TypeName typeName)
Create aSchema.FieldType
for the given type.static Schema.FieldType
row(Schema schema)
Create a map type for the given key and value types.abstract org.apache.beam.sdk.schemas.Schema.FieldType.Builder
toBuilder()
java.lang.String
toString()
boolean
typesEqual(Schema.FieldType other)
Returns true if two FieldTypes are equal.Schema.FieldType
withMetadata(java.lang.String key, byte[] metadata)
Deprecated.use schema options instead.Schema.FieldType
withMetadata(java.lang.String key, java.lang.String metadata)
Deprecated.use schema options instead.Schema.FieldType
withMetadata(java.util.Map<java.lang.String,byte[]> metadata)
Deprecated.use schema options instead.Schema.FieldType
withNullable(boolean nullable)
-
-
-
Field Detail
-
STRING
public static final Schema.FieldType STRING
The type of string fields.
-
BYTE
public static final Schema.FieldType BYTE
The type of byte fields.
-
BYTES
public static final Schema.FieldType BYTES
The type of bytes fields.
-
INT16
public static final Schema.FieldType INT16
The type of int16 fields.
-
INT32
public static final Schema.FieldType INT32
The type of int32 fields.
-
INT64
public static final Schema.FieldType INT64
The type of int64 fields.
-
FLOAT
public static final Schema.FieldType FLOAT
The type of float fields.
-
DOUBLE
public static final Schema.FieldType DOUBLE
The type of double fields.
-
DECIMAL
public static final Schema.FieldType DECIMAL
The type of decimal fields.
-
BOOLEAN
public static final Schema.FieldType BOOLEAN
The type of boolean fields.
-
DATETIME
public static final Schema.FieldType DATETIME
The type of datetime fields.
-
-
Method Detail
-
getTypeName
public abstract Schema.TypeName getTypeName()
-
getNullable
public abstract java.lang.Boolean getNullable()
-
getLogicalType
public abstract @Nullable Schema.LogicalType getLogicalType()
-
getCollectionElementType
public abstract @Nullable Schema.FieldType getCollectionElementType()
-
getMapKeyType
public abstract @Nullable Schema.FieldType getMapKeyType()
-
getMapValueType
public abstract @Nullable Schema.FieldType getMapValueType()
-
getRowSchema
public abstract @Nullable Schema getRowSchema()
-
toBuilder
public abstract org.apache.beam.sdk.schemas.Schema.FieldType.Builder toBuilder()
-
isLogicalType
public boolean isLogicalType(java.lang.String logicalTypeIdentifier)
-
getLogicalType
public <LogicalTypeT extends Schema.LogicalType> LogicalTypeT getLogicalType(java.lang.Class<LogicalTypeT> logicalTypeClass)
Helper function for retrieving the concrete logical type subclass.
-
forTypeName
public static org.apache.beam.sdk.schemas.Schema.FieldType.Builder forTypeName(Schema.TypeName typeName)
-
of
public static Schema.FieldType of(Schema.TypeName typeName)
Create aSchema.FieldType
for the given type.
-
array
public static Schema.FieldType array(Schema.FieldType elementType)
Create an array type for the given field type.
-
array
@Deprecated public static Schema.FieldType array(Schema.FieldType elementType, boolean nullable)
Deprecated.Set the nullability on the elementType instead
-
iterable
public static Schema.FieldType iterable(Schema.FieldType elementType)
-
map
public static Schema.FieldType map(Schema.FieldType keyType, Schema.FieldType valueType)
Create a map type for the given key and value types.
-
map
@Deprecated public static Schema.FieldType map(Schema.FieldType keyType, Schema.FieldType valueType, boolean valueTypeNullable)
Deprecated.Set the nullability on the valueType instead
-
row
public static Schema.FieldType row(Schema schema)
Create a map type for the given key and value types.
-
logicalType
public static <InputT,BaseT> Schema.FieldType logicalType(Schema.LogicalType<InputT,BaseT> logicalType)
Creates a logical type based on a primitive field type.
-
withMetadata
@Deprecated public Schema.FieldType withMetadata(java.util.Map<java.lang.String,byte[]> metadata)
Deprecated.use schema options instead.Set the metadata map for the type, overriding any existing metadata.
-
withMetadata
@Deprecated public Schema.FieldType withMetadata(java.lang.String key, byte[] metadata)
Deprecated.use schema options instead.Returns a copy of the descriptor with metadata set for the given key.
-
withMetadata
@Deprecated public Schema.FieldType withMetadata(java.lang.String key, java.lang.String metadata)
Deprecated.use schema options instead.Returns a copy of the descriptor with metadata set for the given key.
-
getAllMetadata
@Deprecated public java.util.Map<java.lang.String,byte[]> getAllMetadata()
Deprecated.use schema options instead.
-
getMetadata
@Deprecated public byte @Nullable [] getMetadata(java.lang.String key)
Deprecated.use schema options instead.
-
getMetadataString
@Deprecated public java.lang.String getMetadataString(java.lang.String key)
Deprecated.use schema options instead.
-
withNullable
public Schema.FieldType withNullable(boolean nullable)
-
equals
public final boolean equals(@Nullable java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
typesEqual
public boolean typesEqual(Schema.FieldType other)
Returns true if two FieldTypes are equal.
-
equivalent
public boolean equivalent(Schema.FieldType other, Schema.EquivalenceNullablePolicy nullablePolicy)
Check whether two types are equivalent.
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-