-
Notifications
You must be signed in to change notification settings - Fork 791
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate bitmask on BooleanBufferBuilder::resize: #1183
Conversation
|
||
#[test] | ||
fn test_split_off() { | ||
let t = Type::primitive_type_builder("col", PhysicalType::INT32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not find a more ergonomic way to construct this type
94b5a1f
to
bc506a7
Compare
Codecov Report
@@ Coverage Diff @@
## master #1183 +/- ##
==========================================
+ Coverage 82.66% 82.67% +0.01%
==========================================
Files 173 173
Lines 50902 50929 +27
==========================================
+ Hits 42077 42105 +28
+ Misses 8825 8824 -1
Continue to review full report at Codecov.
|
arrow/src/array/builder.rs
Outdated
#[inline] | ||
pub fn resize(&mut self, len: usize) { | ||
let len_bytes = bit_util::ceil(len, 8); | ||
self.buffer.resize(len_bytes, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also set self.len
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes 🤦
Will fix and add a test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tustvold and @jhorstmann
Which issue does this PR close?
Relates to #1037 .
Rationale for this change
When splitting a null bitmask off, the code added in #1054 would return the entire bitmask that was read. This isn't a problem as
ArrayData
doesn't care about trailing data in buffers, in fact it is critical for packed bitmasks and array data slices to work, but it can be a tad surprising.What changes are included in this PR?
Modifies
DefinitionLevelBuffer::split_bitmask
to truncate the returnedBitmap
for the avoidance of confusion. Also uses a more efficientappend_packed_range
to construct the remainder buffer.Are there any user-facing changes?
Adds a
BooleanBufferBuilder::resize
method