rluvaton commented on code in PR #24606:
URL: https://github.com/apache/datafusion/pull/24606#discussion_r3842089413
##########
datafusion/physical-plan/src/aggregates/group_values/null_builder.rs:
##########
@@ -18,72 +18,43 @@
use arrow::array::NullBufferBuilder;
use arrow::buffer::NullBuffer;
-/// Builder for an (optional) null mask
-///
-/// Optimized for avoid creating the bitmask when all values are non-null
-#[derive(Debug)]
-pub(crate) struct MaybeNullBufferBuilder {
- /// Note this is an Arrow *VALIDITY* buffer (so it is false for nulls, true
- /// for non-nulls)
- nulls: NullBufferBuilder,
-}
-
-impl MaybeNullBufferBuilder {
- /// Create a new builder
- pub fn new() -> Self {
- Self {
- nulls: NullBufferBuilder::new(0),
- }
- }
+/// Helper methods for NullBufferBuilder that are used in Group By columns
+pub(crate) trait MaybeNullBufferBuilder {
+ fn empty() -> Self;
/// Return true if the row at index `row` is null
- pub fn is_null(&self, row: usize) -> bool {
- match self.nulls.as_slice() {
- // validity mask means a unset bit is NULL
- Some(_) => !self.nulls.is_valid(row),
- None => false,
- }
- }
+ fn is_null(&self, row: usize) -> bool;
- /// Set the nullness of the next row to `is_null`
- ///
- /// If `value` is true, the row is null.
- /// If `value` is false, the row is non null
- pub fn append(&mut self, is_null: bool) {
- self.nulls.append(!is_null)
- }
Review Comment:
to avoid confusion of `is_null` vs `is_valid` parameter, I updated usages to
be `append_null` and `append_non_null`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]