Repository navigation
Conversation
|
I'll take a look tomorrow |
|
Thanks @emecii. The PR looks good directionally, but I want to be more thorough with performance and memory footprint of Variant. I will file an EPIC for tracking/filing Variant benchmarks. |
|
Filed here - #11101 |
|
For #11052, I can add a benchmark-only PR covering list-index validity: in-bounds/missing indexes, explicit nulls, nested lists, List/ListView, sliced inputs, typed/Variant outputs, and a struct-only control. I'd compare identical fixtures on base/head and measure allocations separately from runtime. An initial local allocation probe shows additional bitmap-union costs on nullable paths, so shared-buffer cloning alone doesn't establish the cost. Does this cover the evidence you'd like before merging the fix? |
|
That'd be great @emecii. Thanks |
|
Opened benchmark-only #11193: 104 deterministic cases with separate timing/allocation measurements; 367 tests, Clippy and formatting pass. The 64-row all-OOB Int64 case produces equivalent output but adds 5 allocations / 224 requested bytes. A reverse-order repeat measured 1.000 → 1.238 µs (~24% slower locally, Apple M4/Rust 1.98). Other cases correct baseline validity bugs, so their timings compare different output semantics. Full confidence intervals, controls and reproduction commands are in #11193; no production optimization is bundled. |
# Which issue does this PR close? Related to apache#11101 and apache#11052. # Rationale for this change Add a small benchmark for `variant_get` list-index lookup when some rows are empty lists. # What changes are included in this PR? Two benchmark functions in the existing `variant_kernels` target, following the nearby cases. The first builds 8,192 rows alternating empty and two-element integer lists, then looks up index zero with Variant output. The same fixture is timed unshredded and shredded as a List of Int64. Fixture construction, shredding, and path setup are outside timing; options cloning and output destruction are included. The second restores the previously regressing small case: 64 one-element `[1]` lists shredded as List<Int64>, index 9 (all out of bounds), and Int64 output. It checks that all 64 results are null before timing. The benchmark name is `variant_get_list_index_all_oob_int64_64_rows`. # Are these changes tested? - `cargo bench --locked -p parquet-variant-compute --bench variant_kernels -- variant_get_list_index --test`: all three cases pass. - Focused Criterion runs completed the mixed-list cases and the all-OOB case (50 samples, 1 s warm-up, 3 s measurement). - `cargo test --locked -p parquet-variant-compute`: 367 unit tests and 13 doc tests passed for the previous revision; this benchmark-only follow-up was validated with the benchmark smoke run, Criterion, Clippy, and formatting. - `cargo clippy --locked -p parquet-variant-compute --all-targets --all-features -- -D warnings` - `cargo fmt --all -- --check`, `git diff --check`, and the repository spelling check with typos 1.37.0 pass. The benchmark runs on the existing baseline without asserting the missing-index validity behavior that apache#11052 fixes. Unshredded and shredded outputs currently differ in validity on empty rows, so these timings do not establish an equivalent-output speedup or the cost of that correctness fix. The earlier ~24% overhead observed in the separate 64-row all-OOB Int64 case remains unresolved; adding its benchmark does not change that result. # Are there any user-facing changes? No. This only adds a benchmark; production code and dependencies are unchanged. # AI usage OpenAI Codex generated this benchmark revision, ran the validation, and drafted this description and review reply.
|
@emecii could you merge the latest changes from main so I can run the new benchmark here? We'll move from there |
…ded-list-null-11050
|
Merged main ( |
|
run benchmark variant_kernels env: |
|
🤖 Benchmark starting (GKE) | trigger Target: variant_kernels Sharding factor: 1 (1 workers). Comparing fix/variant-get-shredded-list-null-11050 (64240f6) to 6d44c7c (merge-base) diff Run configurationrun benchmark variant_kernels
env:
BENCH_FILTER: ^variant_get_list_index
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Target: variant_kernels Comparing fix/variant-get-shredded-list-null-11050 (64240f6) to 6d44c7c (merge-base) diff Run configurationrun benchmark variant_kernels
env:
BENCH_FILTER: ^variant_get_list_index
shards: 1
DetailsPer-runner informationvariant_kernels — shard 1/1Node: gk3-benchmark-cluster-nap-4ffvevr1-a4e5654c-8f6d Instance: c4a-highcpu-48 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench variant_kernelsCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
Thanks @emecii everything looks great! We could optimize all OOB case by adding a fast-path to avoid using |
|
@emecii do you have the bandwidth to make the update? |
|
@emecii could you also enable CI on your fork? |
|
I'll open a new PR using @emecii commits then |
…e#12224) # Which issue does this PR close? - Closes apache#11050. - Supersedes apache#11052. # Rationale for this change This carries @emecii's fix from apache#11052, which was approved but has had no activity since October. The commit is unchanged and keeps their authorship, rebased onto current `main`. An out-of-bounds list lookup and a present Variant null both produce null child columns after `take`. Without tracking index validity separately, shredded input turns missing list positions into valid Variant nulls, unlike unshredded input. # What changes are included in this PR? - Carry the list index validity mask through shredded path traversal (@emecii's commit). - Apply that mask to the output while preserving explicit Variant null elements as valid values. - Regression test distinguishing an empty list, an explicit null element, and a typed element. - When no row has the requested index in bounds, the path step is `Missing` and `take` is skipped. This addresses the all-out-of-bounds slowdown measured in apache#11052. `value` is not consulted because arrays are never stored there when `typed_value` is a list, which matches Spark (`SparkShreddingUtils` returns null for an out-of-bounds index without reading `value`). - For the same reason, the two existing no-match exits of the list index step (elements are not a struct, or elements hold no values) now also return `Missing` instead of falling back to `value` row by row. For valid data this changes no results, since `value` can only hold non-arrays there, which index to NULL. - A `Missing` path step with no `as_type` now returns an all-null `VariantArray`, as documented on `GetOptions::as_type`, instead of a `NullArray`. # Are these changes tested? Yes. `test_shredded_list_out_of_bounds_is_null` distinguishes an empty list, an explicit null element, a typed element, and a non-list row, for both a mixed and an all-out-of-bounds index. The existing missing-path Variant output test now also runs without `as_type`. `variant_get_list_index_all_oob_int64_64_rows` goes from 1.32 µs to 0.47 µs locally compared to apache#11052. The other `variant_get_list_index` benchmarks are within noise. # Are there any significant user-facing changes? `variant_get` without `as_type` now returns an all-null `VariantArray` instead of a `NullArray` when the path cannot match a shredded column, for example a field that does not exist on a fully shredded object. # AI usage disclosure The original change was written with OpenAI Codex (see apache#11052). Claude Code carried the commit over and drafted this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Yifan Chen <[email protected]> --------- Co-authored-by: Yifan Chen <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Which issue does this PR close?
variant_getreturns Variant null instead of SQL NULL for out-of-bounds access on shredded lists #11050.Rationale for this change
An out-of-bounds list lookup and a present Variant null both produce null child columns after take. Without preserving index validity separately, shredded input turns missing list positions into valid Variant nulls, unlike unshredded input.
What changes are included in this PR?
Are these changes tested?
Yes.
Are there any user-facing changes?
Yes. variant_get now returns an Arrow null for an out-of-bounds lookup on shredded list-like values, matching unshredded input semantics.
AI usage
OpenAI Codex assisted with investigating the issue, generating the implementation and tests, running the listed local validation, and drafting this PR description.