Package org.apache.flink.formats.avro
Class RegistryAvroDeserializationSchema<T>
- java.lang.Object
-
- org.apache.flink.formats.avro.AvroDeserializationSchema<T>
-
- org.apache.flink.formats.avro.RegistryAvroDeserializationSchema<T>
-
- Type Parameters:
T
- type of record it produces
- All Implemented Interfaces:
Serializable
,DeserializationSchema<T>
,ResultTypeQueryable<T>
- Direct Known Subclasses:
ConfluentRegistryAvroDeserializationSchema
public class RegistryAvroDeserializationSchema<T> extends AvroDeserializationSchema<T>
Deserialization schema that deserializes from Avro format usingSchemaCoder
.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.DeserializationSchema
DeserializationSchema.InitializationContext
-
-
Constructor Summary
Constructors Constructor Description RegistryAvroDeserializationSchema(Class<T> recordClazz, org.apache.avro.Schema reader, SchemaCoder.SchemaCoderProvider schemaCoderProvider)
Creates Avro deserialization schema that reads schema from input stream using providedSchemaCoder
.RegistryAvroDeserializationSchema(Class<T> recordClazz, org.apache.avro.Schema reader, SchemaCoder.SchemaCoderProvider schemaCoderProvider, AvroFormatOptions.AvroEncoding encoding)
Creates Avro deserialization schema that reads schema from input stream using providedSchemaCoder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
deserialize(byte[] message)
Deserializes the byte message.boolean
equals(Object o)
int
hashCode()
-
Methods inherited from class org.apache.flink.formats.avro.AvroDeserializationSchema
forGeneric, forGeneric, forSpecific, forSpecific, getProducedType, 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 Detail
-
RegistryAvroDeserializationSchema
public RegistryAvroDeserializationSchema(Class<T> recordClazz, @Nullable org.apache.avro.Schema reader, SchemaCoder.SchemaCoderProvider schemaCoderProvider)
Creates Avro deserialization schema that reads schema from input stream using providedSchemaCoder
.- Parameters:
recordClazz
- class to which deserialize. Should be eitherSpecificRecord
orGenericRecord
.reader
- reader's Avro schema. Should be provided if recordClazz isGenericRecord
schemaCoderProvider
- schema provider that allows instantiation ofSchemaCoder
that will be used for schema reading
-
RegistryAvroDeserializationSchema
public RegistryAvroDeserializationSchema(Class<T> recordClazz, @Nullable org.apache.avro.Schema reader, SchemaCoder.SchemaCoderProvider schemaCoderProvider, AvroFormatOptions.AvroEncoding encoding)
Creates Avro deserialization schema that reads schema from input stream using providedSchemaCoder
.- Parameters:
recordClazz
- class to which deserialize. Should be eitherSpecificRecord
orGenericRecord
.reader
- reader's Avro schema. Should be provided if recordClazz isGenericRecord
schemaCoderProvider
- schema provider that allows instantiation ofSchemaCoder
that will be used for schema readingencoding
- Avro serialization approach to use. Required to identify the correct decoder class to use.
-
-
Method Detail
-
deserialize
public T deserialize(@Nullable byte[] message) throws IOException
Description copied from interface:DeserializationSchema
Deserializes the byte message.- Specified by:
deserialize
in interfaceDeserializationSchema<T>
- Overrides:
deserialize
in classAvroDeserializationSchema<T>
- Parameters:
message
- The message, as a byte array.- Returns:
- The deserialized message as an object (null if the message cannot be deserialized).
- Throws:
IOException
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classAvroDeserializationSchema<T>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAvroDeserializationSchema<T>
-
-