refactor: switch BooleanBufferBuilder to NullBufferBuilder in MaybeNullBufferBuilder#14504
Conversation
|
Looks like there are some CI failures so marking this PR as a draft |
b5775c5 to
7b14c35
Compare
|
@alamb I found that p.s. I have fixed CI failures, the PR is ready for review : ) |
alamb
left a comment
There was a problem hiding this comment.
Thank you @Chen-Yuan-Lai -- this looks really nice ❤️
| // BooleanBufferBuilder builder::capacity returns capacity in bits (not bytes) | ||
| Self::Nulls(builder) => builder.capacity() / 8, | ||
| } | ||
| // NullBufferBuilder builder::allocated_size returns capacity in bits |
There was a problem hiding this comment.
Indeed -- I verified this is the case and added some tests here:
| // BooleanBufferBuilder builder::capacity returns capacity in bits (not bytes) | ||
| Self::Nulls(builder) => builder.capacity() / 8, | ||
| } | ||
| // NullBufferBuilder builder::allocated_size returns capacity in bits |
There was a problem hiding this comment.
I actually looked into it more -- I actually think allocated_size returns 8* the actual capacity
|
I also merged this PR up to main to rerun CI |
|
🚀 |
|
Pretty stoked about this one |
Which issue does this PR close?
NullBufferBuilderinstead ofBooleanBufferBuilderfor creating Null masks #14115 .Rationale for this change
As mentioned in #14115 , several examples in DataFusion codebase still using BooleanBufferBuilder rather than NullBufferBuilder, they should be replaced with NullBufferBuilder for optimization.
What changes are included in this PR?
Most methods in
MaybeNullBufferBuildecan be covered byNullBufferBuilder, so I changed the type fromenumtostructwhich only has oneNullBufferBuilder.Are these changes tested?
Are there any user-facing changes?