fix(ArrowBuilder): correct null bit checking logic and add tests#181
Open
maltzsama wants to merge 1 commit into
Open
fix(ArrowBuilder): correct null bit checking logic and add tests#181maltzsama wants to merge 1 commit into
maltzsama wants to merge 1 commit into
Conversation
- Fix `isNull` logic in `BaseBufferBuilder`: return true when the null bit is *not* set, instead of checking `nulls.length == 0` or the bit being set. This correctly identifies null values. - Remove redundant `isNull` override in `ListBufferBuilder`, as the base implementation now works correctly. - Add comprehensive tests for `isNull` behavior across all builder types: - FixedBufferBuilder (Int32, Double, Int8, UInt64) - BoolBufferBuilder - VariableBufferBuilder - Scenarios: all nulls, no nulls, mixed, multiple nulls - Add `.vscode/` to .gitignore. This fixes a bug where null values could be incorrectly reported as non-null when the nulls buffer was empty, and ensures consistent behavior across all Arrow buffer builders.
Member
|
@willtemperley Could you review this? |
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.
What's Changed
BaseBufferBuilder.isNull(_:)was returning the inverse of the null state. Whenappend()writes a non-null value, it callssetBit; when writing null, it callsclearBit. So a set bit means valid. The function was returningisSet(), which means it reported valid values as null and null values as valid.This fix removes the inverted logic and aligns with
ArrowData.isNull(), which correctly uses!isSet().Removed redundant
ListBufferBuilder.isNull()override that is now identical to the base implementation.Testing
Added comprehensive unit tests covering:
All 7 new tests pass. Existing test suite continues to pass.
Impact
No code inside the library calls the builders'
isNull— all internal readers go throughArrowData.isNull— so this affects external users of the public builder API only.Closes #180