Class AvroRowDataSerializationSchema

java.lang.Object
org.apache.flink.formats.avro.AvroRowDataSerializationSchema
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.table.data.RowData>

public class AvroRowDataSerializationSchema extends Object implements org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.table.data.RowData>
Serialization schema that serializes 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.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.SerializationSchema

    org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext
  • Constructor Summary

    Constructors
    Constructor
    Description
    AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType)
    Creates an Avro serialization schema with the given record row type.
    AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.serialization.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.
    AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, AvroFormatOptions.AvroEncoding encoding)
    Creates an Avro serialization schema with the given record row type.
    AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)
    Creates an Avro serialization schema with the given record row type and legacy timestamp mapping flag.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    void
    open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context)
     
    byte[]
    serialize(org.apache.flink.table.data.RowData row)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AvroRowDataSerializationSchema

      public AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType)
      Creates an Avro serialization schema with the given record row type.
    • AvroRowDataSerializationSchema

      public AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, AvroFormatOptions.AvroEncoding encoding)
      Creates an Avro serialization schema with the given record row type.
      Parameters:
      encoding - The serialization approach used to serialize the data.
    • AvroRowDataSerializationSchema

      public AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, AvroFormatOptions.AvroEncoding encoding, boolean legacyTimestampMapping)
      Creates an Avro serialization schema with the given record row type and legacy timestamp mapping flag.
      Parameters:
      encoding - The serialization approach used to serialize the data.
      legacyTimestampMapping - Use the legacy timestamp mapping.
    • AvroRowDataSerializationSchema

      public AvroRowDataSerializationSchema(org.apache.flink.table.types.logical.RowType rowType, org.apache.flink.api.common.serialization.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.
  • Method Details

    • open

      public void open(org.apache.flink.api.common.serialization.SerializationSchema.InitializationContext context) throws Exception
      Specified by:
      open in interface org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.table.data.RowData>
      Throws:
      Exception
    • serialize

      public byte[] serialize(org.apache.flink.table.data.RowData row)
      Specified by:
      serialize in interface org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.table.data.RowData>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object