tustvold commented on a change in pull request #1225:
URL: https://github.com/apache/arrow-rs/pull/1225#discussion_r790337309



##########
File path: arrow/src/array/transform/mod.rs
##########
@@ -83,39 +82,35 @@ impl<'a> _MutableArrayData<'a> {
             .null_count(self.null_count)
             .buffers(buffers)
             .child_data(child_data);
-        if self.null_count > 0 {
-            array_data_builder =
-                array_data_builder.null_bit_buffer(self.null_buffer.into());
+
+        if let Some(mut null_buffer) = self.null_buffer {
+            assert_eq!(null_buffer.len(), self.len, "Inconsistent bitmap");
+            if self.null_count > 0 {
+                array_data_builder =
+                    array_data_builder.null_bit_buffer(null_buffer.finish());
+            }
+        } else {
+            assert_eq!(self.null_count, 0, "Non-zero null count but no null 
bitmap")
         }
 
         array_data_builder
     }
 }
 
-fn build_extend_null_bits(array: &ArrayData, use_nulls: bool) -> 
ExtendNullBits {

Review comment:
       Rather than returning a no-op if use_nulls is false, simply don't 
construct. An ExtendNullBits that does nothing feels like a potential footgun 
that is better to handle in a way that will fail loudly




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