scovich commented on code in PR #9141:
URL: https://github.com/apache/arrow-rs/pull/9141#discussion_r2683125122


##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -93,6 +93,28 @@ impl BooleanArray {
         Self { values, nulls }
     }
 
+    /// It returns a new array with the same data and a new null buffer.
+    ///
+    /// The resulting null buffer is the union of the existing nulls and the 
provided nulls.
+    /// In other words, a slot is valid in the result only if it is valid in 
BOTH
+    /// the existing array AND the provided `nulls`.
+    ///
+    /// # Panics
+    ///
+    /// Panics if `nulls` has a different length than the array.
+    pub fn with_nulls(self, nulls: Option<NullBuffer>) -> Self {
+        if let Some(n) = &nulls {
+            assert_eq!(n.len(), self.len(), "Null buffer length mismatch");
+        }
+
+        let new_nulls = NullBuffer::union(self.nulls.as_ref(), nulls.as_ref());
+
+        Self {
+            values: self.values,
+            nulls: new_nulls,

Review Comment:
   nit: the `let` is making line lengths and line counts worse, not better?
   
   ```suggestion
           Self {
               values: self.values,
               nulls: NullBuffer::union(self.nulls.as_ref(), nulls.as_ref()),
   ```
   (more below)



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

Reply via email to