Skip to content

[Variant] Remove TopLevelRowSink - #12092

Merged
Rich-T-kid merged 1 commit into
apache:mainfrom
sdf-jkl:variant-remove-toplevel-row-sink
Nov 14, 2026
Merged

Rich-T-kid merged 1 commit into
apache:mainfrom
sdf-jkl:variant-remove-toplevel-row-sink

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Nov 5, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

No issue. This cleans up a wrapper added in #10320.

Rationale for this change

unshred_variant wraps its top-level builder in TopLevelRowSink, whose only job is to turn append_null into Variant::Null, because a physical NULL cannot go in the non-nullable output value column. That takes about 30 lines of forwarding code to override one method.

The method it overrides, VariantValueArrayBuilderExt::append_null, has no other callers in the workspace. shred_variant only uses the ext to start an object, and writes its nulls through the inherent VariantValueArrayBuilder::append_null. So the behaviour can live on the builder itself.

What changes are included in this PR?

  • VariantValueArrayBuilderExt::append_null now appends Variant::Null.
  • TopLevelRowSink is removed, and unshred_variant passes the ext directly to the row builders.

unshred_variant output does not change. Missing top-level rows still become Variant::Null, and nested builders keep their own append_null behaviour: list elements become Variant::Null and missing object fields are omitted.

Are these changes tested?

Covered by existing tests, which fail if the ext writes a physical NULL: test_unshred_missing_top_level_value_becomes_variant_null, test_unshred_missing_row_for_decimal_timestamp_object_list, test_unshred_value_only_with_unmasked_nulls_materializes_variant_null, and variant_integration case 129.

Are there any significant user-facing changes?

VariantValueArrayBuilder::builder_ext(..).append_null() now writes Variant::Null instead of a physical NULL. Callers building the value column of a shredded variant should call the inherent VariantValueArrayBuilder::append_null, which is unchanged. No signatures change.

🤖 Generated with Claude Code

`TopLevelRowSink` only exists to override `append_null` on
`VariantValueArrayBuilderExt`, and nothing else calls that method. Make
the method write `Variant::Null` directly, so `unshred_variant` no longer
needs the forwarding wrapper. `unshred_variant` output does not change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the parquet-variant parquet-variant* crates label Nov 5, 2026
@sdf-jkl
sdf-jkl marked this pull request as ready for review November 9, 2026 21:21
@sdf-jkl

sdf-jkl commented Nov 9, 2026

Copy link
Copy Markdown
Member Author

@klion26 @cakeni PTAL

@sdf-jkl

sdf-jkl commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

@Rich-T-kid a quickie 🙏 😅

@Rich-T-kid Rich-T-kid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Rich-T-kid
Rich-T-kid added this pull request to the merge queue Nov 14, 2026
@sdf-jkl

sdf-jkl commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Thank you

Merged via the queue into apache:main with commit 0727b45 Nov 14, 2026
24 checks passed
@Rich-T-kid Rich-T-kid added the enhancement New feature/addition label Nov 16, 2026
sdf-jkl added a commit to peterxcli/arrow-rs that referenced this pull request Nov 20, 2026
…-metadata

Resolve the conflict with apache#12092, which removed `TopLevelRowSink`, and
switch the tests from `StructArrayBuilder` to `StructArrayAssembler`,
which moved to arrow-array in apache#10636.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature/addition parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants