Skip to content

[Variant] Add fallible builder value append API - #11401

Closed
osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:upstream-variant-fallible-builder
Closed

osipovartem wants to merge 1 commit into
apache:mainfrom
Embucket:upstream-variant-fallible-builder

Conversation

@osipovartem

Copy link
Copy Markdown
Contributor

Split from #11177. This adds VariantBuilderExt::try_append_value and fallible implementations for variant, list, object-field, array and top-level row builders. It also preserves object field offsets if a failed append overwrites an existing key. No JSON parsing or decimal conversion changes are included.

Validation: 176 parquet-variant and 371 parquet-variant-compute library tests pass; cargo fmt --check passes. cargo clippy --lib passes with warnings from the installed Rust 1.98.1 toolchain (the repo pins 1.99).

An independent read-only review covered correctness, regressions, performance, API compatibility, and tests and explicitly approved this split.

@Jefffrey

Jefffrey commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@osipovartem

Copy link
Copy Markdown
Contributor Author

Yes, you are right. #11106 already covers the fallible builder API and the unshred error propagation; I missed that overlap. I extracted the distinct object-field rollback bug and its regression tests into #11403. Closing this duplicate PR. Thanks for catching it.

@osipovartem osipovartem closed this Oct 6, 2026
osipovartem added a commit to Embucket/arrow-rs that referenced this pull request Oct 23, 2026
)

### Why
`ObjectBuilder` updates its field-offset map before appending a value.
With duplicate-key validation enabled, rejecting a duplicate can leave
the map changed. With validation disabled, a failed fallible overwrite
truncates bytes but leaves the previous offset unrestored. Continuing to
build the object can then produce an invalid value.

### Change
Reject validated duplicates before mutation and restore the previous
offset when a permitted overwrite fails. The default non-validating path
keeps its existing `fields.insert` fast path. Add regression tests that
continue building after each error. This is independent of the fallible
trait API in apache#11106; it is the unique correction extracted from
superseded apache#11401.

### Validation
- `cargo +1.98.1 test -p parquet-variant --lib`: 176 passed.
- Formatting and `cargo +1.98.1 clippy -p parquet-variant --lib` pass
(installed 1.98.1 reports the repo's newer lint as unknown).
- Focused short Criterion runs showed no repeatable regression, but WSL
measurements were noisy; the default insert path is unchanged.
- Independent read-only review covered correctness, regressions,
performance, API compatibility, and tests; approved with no blockers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet-variant parquet-variant* crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants