Package org.apache.flink.formats.avro
Class AvroRowDataDeserializationSchema
- java.lang.Object
-
- org.apache.flink.formats.avro.AvroRowDataDeserializationSchema
-
- All Implemented Interfaces:
Serializable,org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>,org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.table.data.RowData>
@PublicEvolving public class AvroRowDataDeserializationSchema extends Object implements org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>
Deserialization schema from Avro bytes toRowData.Deserializes the
byte[]messages into (nested) Flink RowData. It converts Avro types into types that are compatible with Flink's Table & SQL API.Projects with Avro records containing logical date/time types need to add a JodaTime dependency.
Note: Changes in this class need to be kept in sync with the corresponding runtime class
AvroRowDataSerializationSchemaand schema converterAvroSchemaConverter.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AvroRowDataDeserializationSchema(org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema, AvroToRowDataConverters.AvroToRowDataConverter runtimeConverter, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo)Creates a Avro deserialization schema for the given logical type.AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo)Creates an Avro deserialization schema for the given logical type.AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding)Creates an Avro deserialization schema for the given logical type.AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)Creates an Avro deserialization schema for the given logical type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.flink.table.data.RowDatadeserialize(byte[] message)booleanequals(Object o)org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData>getProducedType()inthashCode()booleanisEndOfStream(org.apache.flink.table.data.RowData nextElement)voidopen(org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext context)
-
-
-
Constructor Detail
-
AvroRowDataDeserializationSchema
public AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo)Creates an Avro deserialization schema for the given logical type.- Parameters:
rowType- The logical type used to deserialize the data.typeInfo- The TypeInformation to be used bygetProducedType().
-
AvroRowDataDeserializationSchema
public AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding)Creates an Avro deserialization schema for the given logical type.- Parameters:
rowType- The logical type used to deserialize the data.typeInfo- The TypeInformation to be used bygetProducedType().encoding- The serialization approach used to deserialize the data.
-
AvroRowDataDeserializationSchema
public AvroRowDataDeserializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)Creates an Avro deserialization schema for the given logical type.- Parameters:
rowType- The logical type used to deserialize the data.typeInfo- The TypeInformation to be used bygetProducedType().encoding- The serialization approach used to deserialize the data.legacyTimestampMapping- Whether to use legacy timestamp mapping.
-
AvroRowDataDeserializationSchema
public AvroRowDataDeserializationSchema(org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema, AvroToRowDataConverters.AvroToRowDataConverter runtimeConverter, org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> typeInfo)Creates a Avro deserialization schema for the given logical type.- Parameters:
nestedSchema- Deserialization schema to deserialize asGenericRecordruntimeConverter- Converter that transforms aGenericRecordintoRowDatatypeInfo- The TypeInformation to be used bygetProducedType()
-
-
Method Detail
-
open
public void open(org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext context) throws Exception- Specified by:
openin interfaceorg.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>- Throws:
Exception
-
deserialize
public org.apache.flink.table.data.RowData deserialize(@Nullable byte[] message) throws IOException- Specified by:
deserializein interfaceorg.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>- Throws:
IOException
-
isEndOfStream
public boolean isEndOfStream(org.apache.flink.table.data.RowData nextElement)
- Specified by:
isEndOfStreamin interfaceorg.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.table.data.RowData>
-
getProducedType
public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData> getProducedType()
- Specified by:
getProducedTypein interfaceorg.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.table.data.RowData>
-
-