Skip to content

Flink: Support variant for Avro readers and writers - #17737

Open
Guosmilesmile wants to merge 1 commit into
apache:mainfrom
Guosmilesmile:flink_avro_variant
Open

Flink: Support variant for Avro readers and writers#17737
Guosmilesmile wants to merge 1 commit into
apache:mainfrom
Guosmilesmile:flink_avro_variant

Conversation

@Guosmilesmile

@Guosmilesmile Guosmilesmile commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Iceberg v3 defines the Avro encoding for variant: a record with metadata and value binary fields (shredding is not supported in Avro). The core avro layer (ValueWriters.variants() / ValueReaders.variants()) and the Spark bridges (SparkAvroWriter / SparkPlannedAvroReader) already implement this encoding, and the Flink Parquet bridges also support variant.

However, the Flink Avro bridges do not: FlinkAvroWriter and FlinkPlannedAvroReader do not override variant(), so any read or write of an Avro data file containing a variant column fails with:

java.lang.UnsupportedOperationException: Visitor does not support variant

This pr aim to add support variant for Avro readers and writers.

TestFlinkAvroReaderWriter passes with the variant round-trip cases enabled (write records / read RowData, and write RowData via FlinkAvroWriter / read back via FlinkPlannedAvroReader).

Remove the Miss Feature variant from Avro, and use the file format TCK to test this feature as well.

@pvary

pvary commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

CC: @nssalian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants