public class AvroRowDataSerializationSchema extends Object implements SerializationSchema<RowData>
RowData
into Avro bytes.
Serializes objects that are represented in (nested) Flink RowData. It support types that are compatible with Flink's Table & SQL API.
Note: Changes in this class need to be kept in sync with the corresponding runtime class
AvroRowDataDeserializationSchema
and schema converter AvroSchemaConverter
.
SerializationSchema.InitializationContext
Constructor and Description |
---|
AvroRowDataSerializationSchema(RowType rowType)
Creates an Avro serialization schema with the given record row type.
|
AvroRowDataSerializationSchema(RowType rowType,
AvroFormatOptions.AvroEncoding encoding)
Creates an Avro serialization schema with the given record row type.
|
AvroRowDataSerializationSchema(RowType rowType,
AvroFormatOptions.AvroEncoding encoding,
boolean legacyTimestampMapping)
Creates an Avro serialization schema with the given record row type and legacy timestamp
mapping flag.
|
AvroRowDataSerializationSchema(RowType rowType,
SerializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema,
RowDataToAvroConverters.RowDataToAvroConverter runtimeConverter)
Creates an Avro serialization schema with the given record row type, nested schema and
runtime converters.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
void |
open(SerializationSchema.InitializationContext context)
Initialization method for the schema.
|
byte[] |
serialize(RowData row)
Serializes the incoming element to a specified type.
|
public AvroRowDataSerializationSchema(RowType rowType)
public AvroRowDataSerializationSchema(RowType rowType, AvroFormatOptions.AvroEncoding encoding)
encoding
- The serialization approach used to serialize the data.public AvroRowDataSerializationSchema(RowType rowType, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)
encoding
- The serialization approach used to serialize the data.legacyTimestampMapping
- Use the legacy timestamp mapping.public AvroRowDataSerializationSchema(RowType rowType, SerializationSchema<org.apache.avro.generic.GenericRecord> nestedSchema, RowDataToAvroConverters.RowDataToAvroConverter runtimeConverter)
public void open(SerializationSchema.InitializationContext context) throws Exception
SerializationSchema
SerializationSchema.serialize(Object)
and thus suitable for one time setup work.
The provided SerializationSchema.InitializationContext
can be used to access additional features such
as e.g. registering user metrics.
open
in interface SerializationSchema<RowData>
context
- Contextual information that can be used during initialization.Exception
public byte[] serialize(RowData row)
SerializationSchema
serialize
in interface SerializationSchema<RowData>
row
- The incoming element to be serializedCopyright © 2014–2024 The Apache Software Foundation. All rights reserved.