Skip to content

[Not ready for review] feat: Support the canonical Parquet Variant extension type - #26822

Draft
sdf-jkl wants to merge 1 commit into
apache:mainfrom
sdf-jkl:codex/variant-extension
Draft

sdf-jkl wants to merge 1 commit into
apache:mainfrom
sdf-jkl:codex/variant-extension

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Oct 27, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #21144. Follows #21291.

Rationale for this change

Add arrow.parquet.variant to DataFusion's canonical extension type registry, following the thin wrappers used for JSON and other canonical types.

Draft: waiting on moving Arrow's VariantType from parquet-variant-compute into parquet-variant, and adopting an Arrow release containing that move. The current dependency pulls in the compute and JSON crates just to register the extension. Before merging, this PR should depend only on parquet-variant for that type.

What changes are included in this PR?

Add DFVariant and its canonical registration. The wrapper retains the storage datatype and delegates validation and metadata handling to Arrow's VariantType. Values use ordinary storage-type formatting.

Arrow's incomplete storage-field validation is tracked separately in apache/arrow-rs#11938.

What is the testing strategy for this PR?

No new unit tests for the thin delegation wrapper, consistent with the unformatted extensions in #21291.

Formatting, strict workspace Clippy (--all-targets --all-features), cargo check -p datafusion-common -p datafusion-expr --offline, and all 1,471 core integration tests passed. The required extended workspace run stopped after one sort memory-limit failure (154 extended tests passed); that test passed when rerun alone. Later workspace test binaries did not run.

Are there any user-facing changes?

Yes. The canonical registry recognizes arrow.parquet.variant, and DFVariant is available through datafusion_common::types.

@github-actions github-actions Bot added logical-expr Logical plan and expressions common Related to common crate labels Oct 27, 2026
alamb pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Oct 30, 2026
…et-variant` (apache#12005)

# Which issue does this PR close?

- Closes apache#11952.

# Rationale for this change

Using the `arrow.parquet.variant` extension type currently requires
depending on `parquet-variant-compute`, which pulls in the full `arrow`
crate and `parquet-variant-json`. Schema-only consumers such as
`datafusion-common` and `datafusion-expr` (apache/datafusion#26822) only
need the type itself, which depends on nothing beyond `arrow-schema`.

# What changes are included in this PR?

`VariantType` moves unchanged from
`parquet-variant-compute/src/variant_array.rs` to a new
`parquet-variant/src/extension.rs` and is exported as
`parquet_variant::VariantType`. `parquet-variant-compute` re-exports it,
so `parquet_variant_compute::VariantType` and
`parquet::variant::VariantType` keep working and refer to the same type.

# Are these changes tested?

Yes. Existing uses through the old paths (the `VariantArray` doctests,
`variant_get`, and the `parquet` Variant schema tests) are unchanged and
still pass. A new unit test in `parquet-variant` covers the type on its
own: a struct field accepts the extension and a non-struct field is
rejected with the existing error message.

# Are there any significant user-facing changes?

`VariantType` is now also available from `parquet-variant`. The existing
import path is kept, so this is not a breaking change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
@tschwarzinger

Copy link
Copy Markdown
Contributor

I think apart from moving VariantType to the other package this looks good! After that we can add the display integration.

From what I can gather, the display implementation is mostly done in datafusion-variant. Should we add this code to this PR or do a follow-up?

@sdf-jkl

sdf-jkl commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

From what I can gather, the display implementation is mostly done in datafusion-variant. Should we add this code to this PR or do a follow-up?

I thought about doing it separately to make the review process easier 😅

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

Labels

common Related to common crate logical-expr Logical plan and expressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement DFExtensionType for Arrow's Canonical Extension Types

2 participants