Class AvroRowDeserializationSchema

java.lang.Object
org.apache.flink.api.common.serialization.AbstractDeserializationSchema<org.apache.flink.types.Row>
org.apache.flink.formats.avro.AvroRowDeserializationSchema
All Implemented Interfaces:
Serializable, org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.types.Row>, org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.types.Row>

@Internal public class AvroRowDeserializationSchema extends org.apache.flink.api.common.serialization.AbstractDeserializationSchema<org.apache.flink.types.Row>
Deserialization schema from Avro bytes to Row.

Deserializes the byte[] messages into (nested) Flink rows. 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 AvroRowSerializationSchema 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

    Constructors
    Constructor
    Description
    AvroRowDeserializationSchema(Class<? extends org.apache.avro.specific.SpecificRecord> recordClazz)
    Creates a Avro deserialization schema for the given specific record class.
    Creates a Avro deserialization schema for the given Avro schema string.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.types.Row
    deserialize(byte[] message)
     
    boolean
     
    org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row>
     
    int
     

    Methods inherited from class org.apache.flink.api.common.serialization.AbstractDeserializationSchema

    isEndOfStream

    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.DeserializationSchema

    deserialize, open
  • Constructor Details

    • AvroRowDeserializationSchema

      public AvroRowDeserializationSchema(Class<? extends org.apache.avro.specific.SpecificRecord> recordClazz)
      Creates a Avro deserialization schema for the given specific record class. Having the concrete Avro record class might improve performance.
      Parameters:
      recordClazz - Avro record class used to deserialize Avro's record to Flink's row
    • AvroRowDeserializationSchema

      public AvroRowDeserializationSchema(String avroSchemaString)
      Creates a Avro deserialization schema for the given Avro schema string.
      Parameters:
      avroSchemaString - Avro schema string to deserialize Avro's record to Flink's row
  • Method Details

    • deserialize

      public org.apache.flink.types.Row deserialize(byte[] message) throws IOException
      Specified by:
      deserialize in interface org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.types.Row>
      Specified by:
      deserialize in class org.apache.flink.api.common.serialization.AbstractDeserializationSchema<org.apache.flink.types.Row>
      Throws:
      IOException
    • getProducedType

      public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> getProducedType()
      Specified by:
      getProducedType in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.types.Row>
      Overrides:
      getProducedType in class org.apache.flink.api.common.serialization.AbstractDeserializationSchema<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