How-to guide
The Avro connector reads and writes Avro object container files. It supports append and whole-dataset overwrite. The schema is stored in each file.
Before you start
Prepare access using Read and write files. Use an existing .avro file with order_id BIGINT and amount DOUBLE, or create a small dataset with the client write example first.
Use rows (1, 12.5) and (2, 7.5) for the expected results below. This guide concerns Avro files. A Kafka message containing Avro bytes is a separate input.
Read data
The reader uses the schema embedded in the file. Expect two rows and a total amount of 20.0 for the sample data.
Write data
Use the shared guide’s spark connection. The output path must be a private directory covered by a writable mount.
Use mode("append") to add rows. SQL also supports an Avro directory export:
Choose the client or SQL export for the destination, then read it again to check the published data.
Options
See shared read options for storage settings. Do not pass avroSchema, schema-registry settings, header, inferSchema, or a generic compression option to this file connector.
Data types and limits
Avro records map to columns through the file’s schema. Supported logical and nested types depend on the format reader and writer. Use a small read and write check for the actual schema before moving a larger dataset.
Each file is one read unit. The writer buffers batches within its configured memory budget. Keep selected files compatible and size the worker for the data it handles.
The file sink does not support row updates, deletes, merges, or schema-evolution options.
Last modified on November 23, 2026