You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/25 07:46:02 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #1739: Rewrite `ArrayDataBuilder::null_bit_buffer`

tustvold commented on code in PR #1739:
URL: https://github.com/apache/arrow-rs/pull/1739#discussion_r881326194


##########
arrow/src/array/builder.rs:
##########
@@ -630,12 +630,15 @@ impl BooleanBuilder {
         let len = self.len();
         let null_bit_buffer = self.bitmap_builder.finish();
         let null_count = len - null_bit_buffer.count_set_bits();
-        let mut builder = ArrayData::builder(DataType::Boolean)
+        let builder = ArrayData::builder(DataType::Boolean)
             .len(len)
-            .add_buffer(self.values_builder.finish());
-        if null_count > 0 {
-            builder = builder.null_bit_buffer(null_bit_buffer);
-        }
+            .add_buffer(self.values_builder.finish())
+            .null_bit_buffer(if null_count > 0 {

Review Comment:
   This could be written as (null_count > 0).then(|| null_bit_buffer)



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org