Format: Serialization Schema Format: Deserialization Schema
The Avro Schema Registry (
avro-confluent) format allows you to read records that were serialized by the
io.confluent.kafka.serializers.KafkaAvroSerializer and to write records that can in turn be read by the
When reading (deserializing) a record with this format the Avro writer schema is fetched from the configured Confluent Schema Registry based on the schema version id encoded in the record while the reader schema is inferred from table schema.
When writing (serializing) a record with this format the Avro schema is inferred from the table schema and used to retrieve a schema id to be encoded with the data. The lookup is performed with in the configured Confluent Schema Registry under the subject given in
The Avro Schema Registry format can only be used in conjunction with Apache Kafka SQL connector.
In order to use the Avro Schema Registry format the following dependencies are required for both projects using a build automation tool (such as Maven or SBT) and SQL Client with SQL JAR bundles.
|Maven dependency||SQL Client JAR|
Here is an example to create a table using Kafka connector and Confluent Avro format.
|required||(none)||String||Specify what format to use, here should be
|required||(none)||String||The URL of the Confluent Schema Registry to fetch/register schemas|
|required by sink||(none)||String||The Confluent Schema Registry subject under which to register the schema used by this format during serialization|
Currently, Apache Flink always uses the table schema to derive the Avro reader schema during deserialization and Avro writer schema during serialization. Explicitly defining an Avro schema is not supported yet. See the Apache Avro Format for the mapping between Avro and Flink DataTypes.
In addition to the types listed there, Flink supports reading/writing nullable types. Flink maps nullable types to Avro
union(something, null), where
something is the Avro type converted from Flink type.
You can refer to Avro Specification for more information about Avro types.