alamb commented on code in PR #20064:
URL: https://github.com/apache/datafusion/pull/20064#discussion_r2745865252


##########
datafusion/physical-expr-common/src/binary_view_map.rs:
##########
@@ -371,16 +372,7 @@ where
         }
 
         // Build null buffer if we have any nulls
-        let null_buffer = if self.nulls.iter().any(|&is_null| is_null) {
-            Some(NullBuffer::from(
-                self.nulls
-                    .iter()
-                    .map(|&is_null| !is_null)
-                    .collect::<Vec<_>>(),
-            ))
-        } else {
-            None
-        };
+        let null_buffer = self.nulls.finish();

Review Comment:
   ❤️ 



##########
datafusion/physical-expr-common/src/binary_view_map.rs:
##########
@@ -445,7 +437,7 @@ where
         let views_size = self.views.len() * size_of::<u128>();
         let in_progress_size = self.in_progress.capacity();
         let completed_size: usize = self.completed.iter().map(|b| 
b.len()).sum();
-        let nulls_size = self.nulls.len();
+        let nulls_size = self.nulls.len() / 8;

Review Comment:
   I think this should use 
https://docs.rs/arrow/latest/arrow/array/struct.NullBufferBuilder.html#method.allocated_size
 as it is meant to track the allocated size (not the used size)



-- 
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]

Reply via email to