Class AvroRowSerializationSchema

java.lang.Object
org.apache.flink.formats.avro.AvroRowSerializationSchema
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.types.Row>

@Internal public class AvroRowSerializationSchema extends Object implements org.apache.flink.api.common.serialization.SerializationSchema<org.apache.flink.types.Row>
Serialization schema that serializes Row into Avro bytes.

Serializes objects that are represented in (nested) Flink rows. It supports 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 AvroRowDeserializationSchema 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
    AvroRowSerializationSchema(Class<? extends org.apache.avro.specific.SpecificRecord> recordClazz)
    Creates an Avro serialization schema for the given specific record class.
    Creates an Avro serialization schema for the given Avro schema string.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
     
    byte[]
    serialize(org.apache.flink.types.Row row)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.flink.api.common.serialization.SerializationSchema

    open
  • Constructor Details

    • AvroRowSerializationSchema

      public AvroRowSerializationSchema(Class<? extends org.apache.avro.specific.SpecificRecord> recordClazz)
      Creates an Avro serialization schema for the given specific record class.
      Parameters:
      recordClazz - Avro record class used to serialize Flink's row to Avro's record
    • AvroRowSerializationSchema

      public AvroRowSerializationSchema(String avroSchemaString)
      Creates an Avro serialization schema for the given Avro schema string.
      Parameters:
      avroSchemaString - Avro schema string used to serialize Flink's row to Avro's record
  • Method Details

    • serialize

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object