@PublicEvolving public class AvroRowDataDeserializationSchema extends Object implements DeserializationSchema<RowData>
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
.
DeserializationSchema.InitializationContext
Constructor and Description |
---|
AvroRowDataDeserializationSchema(DeserializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema,
AvroToRowDataConverters.AvroToRowDataConverter runtimeConverter,
TypeInformation<RowData> typeInfo)
Creates a Avro deserialization schema for the given logical type.
|
AvroRowDataDeserializationSchema(RowType rowType,
TypeInformation<RowData> typeInfo)
Creates an Avro deserialization schema for the given logical type.
|
AvroRowDataDeserializationSchema(RowType rowType,
TypeInformation<RowData> typeInfo,
AvroFormatOptions.AvroEncoding encoding)
Creates an Avro deserialization schema for the given logical type.
|
AvroRowDataDeserializationSchema(RowType rowType,
TypeInformation<RowData> typeInfo,
AvroFormatOptions.AvroEncoding encoding,
boolean legacyTimestampMapping)
Creates an Avro deserialization schema for the given logical type.
|
Modifier and Type | Method and Description |
---|---|
RowData |
deserialize(byte[] message)
Deserializes the byte message.
|
boolean |
equals(Object o) |
TypeInformation<RowData> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
int |
hashCode() |
boolean |
isEndOfStream(RowData nextElement)
Method to decide whether the element signals the end of the stream.
|
void |
open(DeserializationSchema.InitializationContext context)
Initialization method for the schema.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
deserialize
public AvroRowDataDeserializationSchema(RowType rowType, TypeInformation<RowData> typeInfo)
rowType
- The logical type used to deserialize the data.typeInfo
- The TypeInformation to be used by getProducedType()
.public AvroRowDataDeserializationSchema(RowType rowType, TypeInformation<RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding)
rowType
- The logical type used to deserialize the data.typeInfo
- The TypeInformation to be used by getProducedType()
.encoding
- The serialization approach used to deserialize the data.public AvroRowDataDeserializationSchema(RowType rowType, TypeInformation<RowData> typeInfo, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)
rowType
- The logical type used to deserialize the data.typeInfo
- The TypeInformation to be used by getProducedType()
.encoding
- The serialization approach used to deserialize the data.legacyTimestampMapping
- Whether to use legacy timestamp mapping.public AvroRowDataDeserializationSchema(DeserializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema, AvroToRowDataConverters.AvroToRowDataConverter runtimeConverter, TypeInformation<RowData> typeInfo)
nestedSchema
- Deserialization schema to deserialize as GenericRecord
runtimeConverter
- Converter that transforms a GenericRecord
into RowData
typeInfo
- The TypeInformation to be used by getProducedType()
public void open(DeserializationSchema.InitializationContext context) throws Exception
DeserializationSchema
DeserializationSchema.deserialize(byte[])
and thus suitable for one time setup work.
The provided DeserializationSchema.InitializationContext
can be used to access additional features such
as e.g. registering user metrics.
open
in interface DeserializationSchema<RowData>
context
- Contextual information that can be used during initialization.Exception
public RowData deserialize(@Nullable byte[] message) throws IOException
DeserializationSchema
deserialize
in interface DeserializationSchema<RowData>
message
- The message, as a byte array.IOException
public boolean isEndOfStream(RowData nextElement)
DeserializationSchema
isEndOfStream
in interface DeserializationSchema<RowData>
nextElement
- The element to test for the end-of-stream signal.public TypeInformation<RowData> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<RowData>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.