GH-590: Allow VARIANT value to be omitted#591
Conversation
|
@alamb @emkornfield @zeroshade Please take a look. I found that arrow-rs already allows to omit value array. https://github.com/apache/arrow-rs/blob/7616e10f12894232eacb807993e55427a067d061/parquet-variant-compute/src/variant_array.rs#L858 |
|
Could you help review this? @aihuaxu @steveloughran |
|
I don't think this is correct. The test cases are the ones that we use in Parquet Java and Iceberg to ensure that we can read variant data as long as it can be interpreted correctly. Being liberal about what we accept does not mean that it is a good idea for writers to produce values that way. We don't need to adjust the spec, this is just a reasonable choice for readers so they don't needlessly fail. |
|
Thanks @rdblue for the explanation! Then I agree that this spec doesn't need any change. Perhaps we have two follow-ups to avoid future confusion:
|
|
so, we're saying that it SHOULD always write both? and that writers shouldn't omit the optional value field when it is unnecessary? |
|
@zeroshade I think so. |
|
@zeroshade and @wgtmac, the wording in the current spec is clear:
This spec has been adopted by the community and has deployed implementations, including proprietary implementations. The change proposed here is a compatibility breaking change because it would allow a field that is currently required to be omitted. We should not make changes like this to the spec because it could break implementations that rely on this field. A breaking change like this would need to go into a new compatibility version. |
|
if it's not optional, then arrow-rs must stop issuing shredded variant fields without it; a variant without the value should be added to the test file repository as a bad data example. |
|
If arrow-rs is not producing the |
|
I filed a ticket in arrow-rs to track this report I think we tried to make the malformed variant examples in the parquet-testing corpus clear (aka what is in https://github.com/apache/parquet-testing/tree/master/shredded_variant) by clearly labeling them as INVALID e.g. https://github.com/apache/parquet-testing/blob/master/shredded_variant/case-043-INVALID.parquet |
|
Specifcally, if case-132 is actually invalid, perhaps we should rename https://github.com/apache/parquet-testing/blob/master/shredded_variant/case-132_row-0.variant.bin to case-132-INVALID_row-0.variant.bin |
|
To add some clarity following the arrow-rs report (apache/arrow-rs#10306), here is a survey of how implementations currently handle a variant group that omits the
This supports the spec text as it stands: the implementations that validate variant group structure (DuckDB, Arrow C++) require On how the divergence propagated: the With the spec question settled, the remaining work is enforcement in implementations: arrow-rs's is in progress under apache/arrow-rs#10306, and arrow-go's type validation currently accepts the omission and would need a similar update. |
Rationale for this change
Allow
VARIANTvalue to be omitted.There are some cases in
parquet-testinghttps://github.com/apache/parquet-testing/tree/master/shredded_variant which don't havevaluefield.What changes are included in this PR?
Updated the descriptions in the variant-related Markdown files.
Do these changes have PoC implementations?
No.