Repository navigation
[Variant] Move VariantType from parquet-variant-compute to parquet-variant - #12005
Conversation
Schema-only consumers can now use the `arrow.parquet.variant` extension type without depending on the compute kernels or JSON conversion. `parquet-variant-compute` re-exports it, so the existing path keeps working. Closes apache#11952. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@alamb @Rich-T-kid @Jefffrey PTAL |
| mod variant_to_arrow; | ||
|
|
||
| pub use variant_array::{ShreddingState, VariantArray, VariantArrayIter, VariantType}; | ||
| pub use parquet_variant::VariantType; |
There was a problem hiding this comment.
backwards compatbility pub use 👍
|
Thanks @alamb 🎉 |
|
@alamb we moved it to |
|
It does appear to be a canonical extension type: https://arrow.apache.org/docs/format/CanonicalExtensions.html#parquet-variant So I agree with idea of moving it It would be good to do it before we release another version too |
…ache#12033) # Which issue does this PR close? Follow-up to apache#12005; relates to apache#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; apache#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.
Which issue does this PR close?
VariantTypefromparquet-variant-computetoparquet-variant#11952.Rationale for this change
Using the
arrow.parquet.variantextension type currently requires depending onparquet-variant-compute, which pulls in the fullarrowcrate andparquet-variant-json. Schema-only consumers such asdatafusion-commonanddatafusion-expr(apache/datafusion#26822) only need the type itself, which depends on nothing beyondarrow-schema.What changes are included in this PR?
VariantTypemoves unchanged fromparquet-variant-compute/src/variant_array.rsto a newparquet-variant/src/extension.rsand is exported asparquet_variant::VariantType.parquet-variant-computere-exports it, soparquet_variant_compute::VariantTypeandparquet::variant::VariantTypekeep working and refer to the same type.Are these changes tested?
Yes. Existing uses through the old paths (the
VariantArraydoctests,variant_get, and theparquetVariant schema tests) are unchanged and still pass. A new unit test inparquet-variantcovers 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?
VariantTypeis now also available fromparquet-variant. The existing import path is kept, so this is not a breaking change.🤖 Generated with Claude Code