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


##########
datafusion/physical-expr-common/src/binary_view_map.rs:
##########
@@ -371,17 +374,18 @@ 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<_>>(),
-            ))
+        let null_buffer = if self.nulls.len() > 0 {
+            let nulls = self.nulls.finish();
+
+            // nulls buffer stores true = null, but Arrow expects true = valid
+            let valid = nulls.not();

Review Comment:
   This seems a bit wasteful, we should just write the true / false earlier



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