Skip to content

feat(core): support variant reads via arrow-rs#631

Draft
wirybeaver wants to merge 1 commit into
apache:mainfrom
wirybeaver:feat/variant-support-hudi
Draft

feat(core): support variant reads via arrow-rs#631
wirybeaver wants to merge 1 commit into
apache:mainfrom
wirybeaver:feat/variant-support-hudi

Conversation

@wirybeaver

Copy link
Copy Markdown

Closes #630.

Summary

Adds read compatibility for Hudi Variant columns by using arrow-rs/parquet-rs Variant support rather than adding a hudi-rs-specific Variant model.

What changes are included in this PR?

Dependencies: Arrow-rs Variant

  • Enables parquet/variant_experimental in the workspace dependency.
  • Uses the existing parquet::variant::{VariantType, VariantArray} APIs available in the current Arrow/Parquet 57 dependency line.

Core: Schema / Read Compatibility

  • Detects Hudi Avro records with logicalType = "variant" during Avro-to-Arrow conversion.
  • Represents Variant columns as Arrow Struct fields with arrow.parquet.variant extension metadata.
  • Preserves the existing public read API that returns Arrow RecordBatch values.

Avro

  • Validates canonical Variant child fields such as metadata, value, and optional typed_value.
  • Adds tests showing Avro-decoded Variant columns can be converted with VariantArray::try_new.
  • Covers child lookup by field name rather than position.

Parquet

  • Relies on parquet-rs to read/write the Parquet Variant logical type through Arrow extension metadata.
  • Adds tests for reading a real temporary Variant Parquet file and projecting the Variant column by top-level name.

Out of scope

  • Variant write support for Hudi tables.
  • New hudi-rs-specific public Variant APIs.
  • SQL/query functions for nested Variant values.

Test Plan

  • make format-rust
  • cargo test -p hudi-core avro_to_arrow --lib
  • cargo test -p hudi-core file_group::base_file::parquet::tests --lib
  • cargo test -p hudi-core --lib
  • make check-rust
  • make test-rust
  • cargo +1.91.1 check --workspace --all-targets --all-features
  • git diff --check

Python checks were not run locally because ruff, mypy, and uv are not installed in this environment.

Enable parquet-rs Variant support and map Hudi Avro variant logical records to Arrow extension-marked struct fields.

Add Avro schema/reader tests and Parquet base-file read/projection tests covering VariantArray conversion.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Hudi Variant reads via Arrow-rs

1 participant