@ParametersAreNonnullByDefault public class TypeInformationSchemaConversions extends Object implements SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
SchemaConversions
that can convert to Flink DataStream API TypeInformation.
Used by JsonSchemaFlinkConverter.
If you modify this class, please also augment DataTypeSchemaConversions
accordingly.
To handle proper conversion between Table API and DataStream,
Flink needs the types consistently converted to the same underlying representations.SchemaConversions.RowField<T>
Constructor and Description |
---|
TypeInformationSchemaConversions() |
Modifier and Type | Method and Description |
---|---|
org.apache.flink.api.common.typeinfo.TypeInformation<?> |
typeArray(org.apache.flink.api.common.typeinfo.TypeInformation<?> elementType,
boolean elementsAreNullable)
elementsAreNullable is ignored, element values can always be null. |
org.apache.flink.api.common.typeinfo.TypeInformation<Boolean> |
typeBoolean() |
org.apache.flink.api.common.typeinfo.TypeInformation<Double> |
typeDecimal() |
org.apache.flink.api.common.typeinfo.TypeInformation<Long> |
typeInteger() |
org.apache.flink.api.common.typeinfo.TypeInformation<?> |
typeMap(org.apache.flink.api.common.typeinfo.TypeInformation<?> keyType,
org.apache.flink.api.common.typeinfo.TypeInformation<?> valueType,
boolean valuesAreNullable)
valuesAreNullable is ignored, an map values can always be null. |
org.apache.flink.api.common.typeinfo.TypeInformation<Void> |
typeNull() |
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> |
typeRow(List<SchemaConversions.RowField<org.apache.flink.api.common.typeinfo.TypeInformation<?>>> rowFields)
Converts rowFields to
TypeInformation of Row . |
org.apache.flink.api.common.typeinfo.TypeInformation<String> |
typeString() |
org.apache.flink.api.common.typeinfo.TypeInformation<Instant> |
typeTimestamp()
There are many ways to represent timestamps.
|
public org.apache.flink.api.common.typeinfo.TypeInformation<Void> typeNull()
typeNull
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.VOID
public org.apache.flink.api.common.typeinfo.TypeInformation<Boolean> typeBoolean()
typeBoolean
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.BOOLEAN
public org.apache.flink.api.common.typeinfo.TypeInformation<String> typeString()
typeString
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.STRING
public org.apache.flink.api.common.typeinfo.TypeInformation<Double> typeDecimal()
typeDecimal
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.DOUBLE
public org.apache.flink.api.common.typeinfo.TypeInformation<Long> typeInteger()
typeInteger
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.LONG
public org.apache.flink.api.common.typeinfo.TypeInformation<Instant> typeTimestamp()
TimestampData
to DataStream API types.
In DataTypeSchemaConversions.typeTimestamp()
,
we use DataTypes.TIMESTAMP_LTZ(int)
,
which will end up using org.apache.flink.table.data.conversion.LocalZonedTimestampInstantConverter
when doing conversions. So, we choose Instant
here.typeTimestamp
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.INSTANT
public org.apache.flink.api.common.typeinfo.TypeInformation<?> typeArray(org.apache.flink.api.common.typeinfo.TypeInformation<?> elementType, boolean elementsAreNullable)
elementsAreNullable
is ignored, element values can always be null.
See Types.OBJECT_ARRAY(org.apache.flink.api.common.typeinfo.TypeInformation<E>)
.typeArray
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.OBJECT_ARRAY(org.apache.flink.api.common.typeinfo.TypeInformation<E>)
(elementType)public org.apache.flink.api.common.typeinfo.TypeInformation<?> typeMap(org.apache.flink.api.common.typeinfo.TypeInformation<?> keyType, org.apache.flink.api.common.typeinfo.TypeInformation<?> valueType, boolean valuesAreNullable)
valuesAreNullable
is ignored, an map values can always be null.
See Types.MAP(org.apache.flink.api.common.typeinfo.TypeInformation<K>, org.apache.flink.api.common.typeinfo.TypeInformation<V>)
.typeMap
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.MAP(org.apache.flink.api.common.typeinfo.TypeInformation<K>, org.apache.flink.api.common.typeinfo.TypeInformation<V>)
(keyType, valueType)public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> typeRow(@Nonnull List<SchemaConversions.RowField<org.apache.flink.api.common.typeinfo.TypeInformation<?>>> rowFields)
TypeInformation
of Row
.
RowField
description and isNullable is ignored.
Every field can be null independent of the field's type.
See Types.ROW_NAMED(java.lang.String[], org.apache.flink.api.common.typeinfo.TypeInformation<?>...)
typeRow
in interface SchemaConversions<org.apache.flink.api.common.typeinfo.TypeInformation<?>>
Types.ROW_NAMED(java.lang.String[], org.apache.flink.api.common.typeinfo.TypeInformation<?>...)
with RowFields names and types.Copyright © 2025. All rights reserved.