-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
refactor: switch BooleanBufferBuilder to NullBufferBuilder in MaybeNullBufferBuilder #14504
base: main
Are you sure you want to change the base?
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 : ) |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed -- I verified this is the case and added some tests here:
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.
Nice find
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Which issue does this PR close?
Closes #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
MaybeNullBufferBuilde
can be covered byNullBufferBuilder
, so I changed the type fromenum
tostruct
which only has oneNullBufferBuilder
.Are these changes tested?
Are there any user-facing changes?