Skip to content

fix(arrow/extensions): avoid child values for missing variant lists - #1293

Merged
zeroshade merged 1 commit into
apache:mainfrom
matanper:codex/variant-null-parent-lists
Sep 8, 2026
Merged

zeroshade merged 1 commit into
apache:mainfrom
matanper:codex/variant-null-parent-lists

Conversation

@matanper

@matanper matanper commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

Writing shredded VARIANT values to Parquet fails with lists with non-zero length null components are not supported when a nested list has a null, missing, or scalar parent between populated rows. For example:

{"obj":{"items":[1]}}
{"obj":null}
{"obj":{"items":[2]}}

shreddedObjBuilder.AppendMissing marks the parent struct null, but recursively calling shreddedArrayBuilder.AppendMissing adds 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.AppendMissing append 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=1
  • go test ./arrow/extensions ./parquet/variant

Are 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.

@matanper
matanper requested a review from zeroshade as a code owner September 6, 2026 13:45

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@zeroshade
zeroshade merged commit 97f780b into apache:main Sep 8, 2026
57 of 59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Parquet] Shredded VARIANT nested lists fail to write when the parent object is null or missing

2 participants