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 to
RowData.
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
AvroRowDataSerializationSchema and schema converter AvroSchemaConverter.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext -
Constructor Summary
ConstructorsConstructorDescriptionAvroRowDataDeserializationSchema(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
Modifier and TypeMethodDescriptionorg.apache.flink.table.data.RowDatadeserialize(byte[] message) booleanorg.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.table.data.RowData>inthashCode()booleanisEndOfStream(org.apache.flink.table.data.RowData nextElement) voidopen(org.apache.flink.api.common.serialization.DeserializationSchema.InitializationContext context) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
deserialize
-
Constructor Details
-
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 Details
-
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
- 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>
-
equals
-
hashCode
public int hashCode()
-