Repository navigation
fix(variant): preserve nulls for missing shredded list indexes - #12224
Conversation
When no row has the requested index in bounds, the shredded list index step returns Missing without calling take or reading value. Arrays are never stored in value when typed_value is a list, so no row can match. A Missing path step without as_type now returns an all-null VariantArray, as documented on GetOptions::as_type, instead of a NullArray. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
run benchmark variant_kernels env: |
|
🤖 Benchmark starting (GKE) | trigger Target: variant_kernels Sharding factor: 1 (1 workers). Comparing variant-get-shredded-list-null-11050 (01cfe0e) to 275adb2 (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 variant-get-shredded-list-null-11050 (01cfe0e) to 275adb2 (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-lxiegy2m-5957d461-dftn Instance: c4a-highmem-16 (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 |
|
FYI -- There's some stuff on top of the original @emecii changes |
|
Thanks @Jefffrey @Rich-T-kid @emecii 🙏 |
…pache#11504) - Preserve SQL NULL for missing shredded object fields while retaining explicit JSON nulls. - Reuse apache#12224’s `path_nulls` and cover nested paths, fallback values, empty objects, and sliced arrays. - Closes apache#11191. --------- Co-authored-by: Shatrughna Upadhyay <[email protected]> Co-authored-by: Kosta Tarasov <[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
This carries @emecii's fix from #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?
Missingandtakeis skipped. This addresses the all-out-of-bounds slowdown measured in fix(variant): preserve nulls for missing shredded list indexes #11052.valueis not consulted because arrays are never stored there whentyped_valueis a list, which matches Spark (SparkShreddingUtilsreturns null for an out-of-bounds index without readingvalue).Missinginstead of falling back tovaluerow by row. For valid data this changes no results, sincevaluecan only hold non-arrays there, which index to NULL.Missingpath step with noas_typenow returns an all-nullVariantArray, as documented onGetOptions::as_type, instead of aNullArray.Are these changes tested?
Yes.
test_shredded_list_out_of_bounds_is_nulldistinguishes 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 withoutas_type.variant_get_list_index_all_oob_int64_64_rowsgoes from 1.32 µs to 0.47 µs locally compared to #11052. The othervariant_get_list_indexbenchmarks are within noise.Are there any significant user-facing changes?
variant_getwithoutas_typenow returns an all-nullVariantArrayinstead of aNullArraywhen 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 #11052). Claude Code carried the commit over and drafted this description.
🤖 Generated with Claude Code
Co-authored-by: Yifan Chen [email protected]