fix(blob): read empty blobs correctly under physical projection#7599
Open
zhangyang0418 wants to merge 1 commit into
Open
fix(blob): read empty blobs correctly under physical projection#7599zhangyang0418 wants to merge 1 commit into
zhangyang0418 wants to merge 1 commit into
Conversation
An empty (non-null, zero-length) blob is encoded as a descriptor with `position == 0, size == 0`. Reading a blob column as binary (physical projection / BlobHandling::AllBinary) mishandled these on two independent decode paths, causing every value after the first empty blob to be read back empty (or the scan to error out entirely). - v2.1 structural path (encodings/logical/primitive/blob.rs): byte buffers were assigned to blobs using `blob.def == 0`. An empty blob decodes to `rep == 0, def == 0`, identical to a real blob, so it stole a buffer meant for a following real blob and shifted every subsequent assignment. Track an explicit `has_data` flag (set when the descriptor had `size > 0`) and key byte assignment off that instead. - v2.0 legacy path (previous/encodings/logical/blob.rs): one I/O range was submitted per row, including a degenerate `0..0` range for empty blobs. That range never "overlaps" anything in the scheduler's coalescing/reassembly step (`is_overlapping` is always false for an empty interval), so the scheduler dropped it and misaligned the bytes for every subsequent row. Submit ranges only for `size > 0` rows and splice empty `Bytes` back in for the skipped rows. Existing round-trip coverage only exercised null values, never an empty non-null value interleaved with real data. Add a Rust round-trip test (covers v2.0 and v2.1) and a Python end-to-end scan test that reproduce the regression and now pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7598.
Summary
FileScheduler::submit_request, matching theEncodingsIocontract.Testing
cargo fmt --allcargo test -p lance-io scheduler::tests::test_empty_ranges_preserve_result_ordercargo test -p lance-io scheduler::tests::test_split_coalescecargo test -p lance-encoding test_blob_round_trip_with_empty_valuecargo test -p lance-encoding previous::encodings::logical::blob::testsmake installfrompython/uv run pytest python/tests/test_blob.py::test_scan_blob_as_binary_with_empty_valuefrompython/uv run pytest python/tests/test_blob.py -k "scan_blob_as_binary"frompython/uv run make lintfrompython/Not run: root
cargo clippy --all --tests --benches -- -D warningswas not completed before opening this PR.