fix: shift offsets after trimming values in merge_with_schema#6581
fix: shift offsets after trimming values in merge_with_schema#6581kaan-simbe wants to merge 3 commits into
Conversation
|
Thanks, I agree with the root cause and the fix direction. Could you also add a higher-level regression through the scan/take path? The new unit test covers the local invariant, but the user-facing failure is |
|
Thanks for the review @Xuanwo! Added in aecf0bc:
One note: I couldn't shrink the dataset below ~500k rows and still reproduce the panic — at ~250k it stops triggering, so the regression test runs ~0.7s for all 3 cases. |
aecf0bc to
dadd3cd
Compare
- Refactor the sliced-list merge_with_schema test into a generic helper and add a LargeList case. - Add a scan().filter().project([list_struct_col]) regression in scanner.rs that forces the panicking TakeExec -> merge_with_schema path via MaterializationStyle::AllEarlyExcept.
dadd3cd to
6e5fbe0
Compare
|
@Xuanwo anything else I can do here? |
|
We encountered a similar problem in our production environment, and the issue was resolved after trying to cherry pick this PR. |
Summary
InvalidArgumentError("Max offset of X exceeds length of values Y")inListArray::newduringto_table(filter=..., columns=[list_struct_col, ...])on v2.0 datasets.merge_with_schema(called fromTakeStream::map_batch) passedleft_list.trimmed_values()alongsideleft_list.offsets().clone(). When the left list is a sliced view (e.g. a filtered batch), offsets do not start at zero and reference positions past the end of the trimmed child, panicking inListArray::new.ListArrayExt::trimmed_offsets()that returns offsets shifted to start at zero, and use it in theList/LargeListbranches ofmerge_with_schema.Test plan
test_merge_with_schema_sliced_list_structinlance-arrow: fails onmainwith the exact panic, passes with the fix.lance-arrowmerge tests still pass (9/9).200k + 800k + 14650sparse-tail pattern) no longer panics and returns the expected 214,650 rows with correct data (verified against a manually-filtered reference batch).Fixes #6580