Uh oh!
There was an error while loading. Please reload this page.
GH-47838: [C++][Parquet] Set Variant specification version to 1 to align with the variant spec - #47835
Conversation
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
aihuaxu
commented
Oct 16, 2025
@wgtmac Can you take a look? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
a7c4d0d to
3450f1cComparepitrou
commented
Oct 17, 2025
Why is it not the case for our own reader? |
aihuaxu
commented
Oct 17, 2025
You mean Parquet C++ reader? Currently Parquet C++ reader hasn't implemented Variant read/write yet. The only thing it added is to support Variant logical type and we are not doing the check. Currently Variant spec version is version 1 (and this is the only version) and the other readers may/may not add the check. |
4b65ada to
38a919dCompareaihuaxu
commented
Oct 17, 2025
raulcd
commented
Oct 17, 2025
Sorry, because I might be missing something obvious, I am not too familiar with this part of the codebase, but if we haven't implemented Parquet C++ Variant write yet, I am not sure I understand how can a user would be able to create Variant files with a logical type annotation that will be incorrect with Parquet C++ if we release without this fix. |
aihuaxu
commented
Oct 17, 2025
The engines will implement the reader/writer parts but will use the variant type defined in Arrow Parquet. That would cause the engines to write incorrect annotation. That's what I'm seeing internally. |
raulcd
commented
Oct 20, 2025
We haven't been able to publish Python 3.14 wheels for PyArrow and the community is eager to get those. @pitrou@wgtmac can you help with this issue? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| std::shared_ptr<const LogicalType> VariantLogicalType::Make(const int8_t specVersion) { | ||
| auto logical_type = std::shared_ptr<VariantLogicalType>(new VariantLogicalType()); |
There was a problem hiding this comment.
Can we use std::make_shared? It's more terse and more efficient.
There was a problem hiding this comment.
Has this been addressed or resolved?
There was a problem hiding this comment.
Unfortunately the VariantLogicalType constructor is private, so std::make_shared cannot work with it.
Uh oh!
There was an error while loading. Please reload this page.
pitrou
commented
Oct 20, 2025
You mean help with the 3.14 wheels? I'm not sure I understand your message correctly.
I would not call it a blocker entirely, but we would certainly rather have it. |
raulcd
commented
Oct 20, 2025
No, sorry, I meant this issue which is currently holding the release and holding things like publishing the Python 3.14 wheels. |
38a919d to
cc1a45bCompare
pitrou
left a comment
There was a problem hiding this comment.
+1 now that comments are addressed. Let's wait for CI.
pitrou
commented
Oct 20, 2025
CI failures are unrelated, I'll merge. Thanks for spotting and fixing this @aihuaxu ! |
pitrou
commented
Oct 20, 2025
@raulcd I'll let you make the final decision, but it would be nice if a new RC could be issued with this fix. |
raulcd
commented
Oct 20, 2025
I'll create a new RC. Thanks everyone for the quick fix! |
…ign with the variant spec (#47835) ### Rationale for this change According to the [Variant specification](https://github.com/apache/parquet-format/blob/master/VariantEncoding.md), the specification_version field must be set to 1 to indicate Variant encoding version 1. Currently, this field defaults to 0, which violates the specification. Parquet readers that strictly enforce specification version validation will fail to read files containing Variant types. <img width="624" height="185" alt="image" src="https://github.com/user-attachments/assets/b0f1deb9-0301-4b94-a472-17fd9cc0df5d" /> ### What changes are included in this PR? The change includes defaulting the specification version to 1. ### Are these changes tested? The change is covered by unit test. ### Are there any user-facing changes? The Parquet files produced the variant logical type annotation `VARIANT(1)`. ``` Schema: message schema { optional group V (VARIANT(1)) = 1 { required binary metadata; required binary value; } } ``` * GitHub Issue: #47838 Lead-authored-by: Aihua <aihua.xu@snowflake.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
wgtmac
commented
Oct 20, 2025
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 5f616db. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 6 possible false positives for unstable benchmarks that are known to sometimes produce them. |
… to align with the variant spec (apache#47835) ### Rationale for this change According to the [Variant specification](https://github.com/apache/parquet-format/blob/master/VariantEncoding.md), the specification_version field must be set to 1 to indicate Variant encoding version 1. Currently, this field defaults to 0, which violates the specification. Parquet readers that strictly enforce specification version validation will fail to read files containing Variant types. <img width="624" height="185" alt="image" src="https://github.com/user-attachments/assets/b0f1deb9-0301-4b94-a472-17fd9cc0df5d" /> ### What changes are included in this PR? The change includes defaulting the specification version to 1. ### Are these changes tested? The change is covered by unit test. ### Are there any user-facing changes? The Parquet files produced the variant logical type annotation `VARIANT(1)`. ``` Schema: message schema { optional group V (VARIANT(1)) = 1 { required binary metadata; required binary value; } } ``` * GitHub Issue: apache#47838 Lead-authored-by: Aihua <aihua.xu@snowflake.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
… to align with the variant spec (apache#47835) ### Rationale for this change According to the [Variant specification](https://github.com/apache/parquet-format/blob/master/VariantEncoding.md), the specification_version field must be set to 1 to indicate Variant encoding version 1. Currently, this field defaults to 0, which violates the specification. Parquet readers that strictly enforce specification version validation will fail to read files containing Variant types. <img width="624" height="185" alt="image" src="https://github.com/user-attachments/assets/b0f1deb9-0301-4b94-a472-17fd9cc0df5d" /> ### What changes are included in this PR? The change includes defaulting the specification version to 1. ### Are these changes tested? The change is covered by unit test. ### Are there any user-facing changes? The Parquet files produced the variant logical type annotation `VARIANT(1)`. ``` Schema: message schema { optional group V (VARIANT(1)) = 1 { required binary metadata; required binary value; } } ``` * GitHub Issue: apache#47838 Lead-authored-by: Aihua <aihua.xu@snowflake.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
Rationale for this change
According to the Variant specification, the specification_version field must be set to 1 to indicate Variant encoding version 1. Currently, this field defaults to 0, which violates the specification. Parquet readers that strictly enforce specification version validation will fail to read files containing Variant types.

What changes are included in this PR?
The change includes defaulting the specification version to 1.
Are these changes tested?
The change is covered by unit test.
Are there any user-facing changes?
The Parquet files produced the variant logical type annotation
VARIANT(1).