Repository navigation
fix(arrow/extensions): avoid child values for missing variant lists - #1293
Conversation
zeroshade
left a comment
There was a problem hiding this comment.
Confirmed and verified. I reproduced all three regression cases on current main (each fails with lists with non-zero length null components are not supported), and they pass on this branch along with the full arrow/extensions, parquet/variant, and parquet/pqarrow suites.
The fix is also structurally right: the parent shreddedObjBuilder.AppendMissing already nulls the field's value column before delegating, so the list typed builder only needs to null its own list — which matches how tryTyped represents the non-array residual case. The old code fabricated a placeholder child element beneath a null parent, which is exactly what the Parquet writer rejects.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Arrow Go maintainer.
Rationale for this change
Writing shredded VARIANT values to Parquet fails with
lists with non-zero length null components are not supportedwhen a nested list has a null, missing, or scalar parent between populated rows. For example:{"obj":{"items":[1]}} {"obj":null} {"obj":{"items":[2]}}shreddedObjBuilder.AppendMissingmarks the parent struct null, but recursively callingshreddedArrayBuilder.AppendMissingadds a valid list and a placeholder child element. The Parquet writer rejects the resulting skipped child range.Fixes #1292.
What changes are included in this PR?
Make
shreddedArrayBuilder.AppendMissingappend a null list without adding child elements. The production change is two added lines (including a comment) and four removed lines.Add a self-contained Parquet write/read regression for null, missing, and scalar parent values between populated lists. It verifies all decoded JSON values, row count, and checked-allocator cleanup. No external fixtures are required.
Are these changes tested?
All three regression cases reproduce the original write error before the fix and pass afterward.
go test ./parquet/pqarrow -run TestShreddedVariantListsUnderMissingParent -count=1go test ./arrow/extensions ./parquet/variantAre there any user-facing changes?
These valid shredded VARIANT values can now be written to Parquet while preserving null, missing, and scalar parent values. No public API changes.