test(blob): cover mixed-nullability batches in one write - #8081
Closed
wjones127 wants to merge 1 commit into
Closed
Conversation
The blob encoder derives each page's definition interpretation from the validity bitmap of the batch it saw, so a single write whose batches disagree about nullability used to panic in debug builds and lose the nulls in release builds. lance-format#8070 fixed this by closing the pending descriptor page whenever the interpretation changes, but the Rust coverage stops at the encoder; the dataset write path is only covered from Python, via compaction. This adds a `Dataset::write` regression test for a nullable blob column whose batches disagree, in both orders. Co-Authored-By: Claude Opus 5 (1M context) <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.
A blob page records a single interpretation of its definition levels, and the encoder takes that interpretation from whichever batch it happened to see first. Because the interpretation is derived from the batch's validity bitmap rather than the schema, a null-free batch and a batch containing a null disagree — so one write could panic in debug builds and silently turn a null into an empty value in release builds. #8070 fixed that by closing the pending descriptor page whenever the interpretation changes.
That fix is covered by an encoder-level Rust test and, at the dataset level, only from Python via compaction. This adds a Rust regression test that writes a nullable blob column whose batches disagree about nullability, in both orders, and asserts every value and the null survive the round trip.
Verified the test fails on
e4288373a(before #8070) and passes onmain.Closes #8077, which was filed against
e4288373aand is already fixed onmain.