Avro
1 min read
This article introduces you to usage examples, configuration options, and type mappings of the Avro format.
Background Information
The Avro format allows reading and writing of Avro data based on Avro structures. Currently, the Avro structure is derived based on the table structure.
Example of use
SQL
1 CREATE TABLE user_behavior (
2 user_id BIGINT,
3 item_id BIGINT,
4 category_id BIGINT,
5 behavior STRING,
6 ts TIMESTAMP(3)
7 ) WITH (
8 'connector' = 'kafka',
9 'topic' = 'user_behavior',
10 'properties.bootstrap.servers' = 'localhost :9092',
11 'properties.group.id' = 'testGroup',
12 'format' = 'avro'
13 )Configuration Options
Type Mapping
In addition to the above types, Flink supports reading and writing nullable types. Flink maps nullable types to Avrounion(something, null), where something is an Avro type converted from a Flink type.
Note
For information about Avro types, see Avro specification.
Was this helpful?