Skip to content

[Variant] Move VariantType into arrow-schema canonical extensions - #12033

Merged
alamb merged 1 commit into
apache:mainfrom
sdf-jkl:codex/variant-type-canonical
Nov 3, 2026
Merged

alamb merged 1 commit into
apache:mainfrom
sdf-jkl:codex/variant-type-canonical

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Nov 2, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Follow-up to #12005; relates to #11952.

Rationale for this change

Schema-only consumers still need parquet-variant to use VariantType, and Field::try_canonical_extension_type does not recognize arrow.parquet.variant. Hosting the descriptor alongside the other canonical extensions lets these consumers use arrow-schema directly.

What changes are included in this PR?

Move VariantType into arrow-schema's canonical extensions and register CanonicalExtensionType::Variant. Re-export the same type from parquet-variant, preserving the existing compute and Parquet import paths. Metadata handling and storage validation are unchanged; #11938 remains separate.

Are these changes tested?

The moved unit test retains the existing storage-type checks and now verifies canonical extension lookup. Existing Variant compute doctests and Parquet Variant tests exercise the retained import paths.

Are there any significant user-facing changes?

Existing imports remain compatible. Direct arrow-schema users need its canonical_extension_types feature. parquet-variant now enables that feature to retain its unconditional re-export, which also enables serde_core and serde_json dependencies in arrow-schema.

Implementation and test changes prepared with Codex.

@github-actions github-actions Bot added parquet-variant parquet-variant* crates arrow-core Core crates related to representing arrow data labels Nov 2, 2026
@sdf-jkl

sdf-jkl commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

@alamb a quick follow up to #12005

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thanks @sdf-jkl

/// The extension type for Parquet Variant.
///
/// <https://arrow.apache.org/docs/format/CanonicalExtensions.html#parquet-variant>
Variant(VariantType),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is marked as #[non_exhaustive] this is not a breaking API change

@alamb
alamb added this pull request to the merge queue Nov 3, 2026
Merged via the queue into apache:main with commit 8e9eec3 Nov 3, 2026
21 checks passed
@sdf-jkl

sdf-jkl commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

Thank you @alamb 🚀

@sdf-jkl
sdf-jkl deleted the codex/variant-type-canonical branch November 3, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow-core Core crates related to representing arrow data parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants