Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions arrow-array/src/array/boolean_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,22 @@ impl BooleanArray {
return self;
};

let mut builder = BooleanBufferBuilder::new(len);
builder.append_buffer(&self.values.slice(0, end));
builder.append_n(len - end, false);
BooleanArray::new(builder.finish(), self.nulls)
let mut_buffer_result = self.values.into_inner().into_mutable();
match mut_buffer_result {
Ok(mut mutable_buffer) => {
for i in end..len {
bit_util::unset_bit(mutable_buffer.as_slice_mut(), i);
}
Comment on lines +599 to +601

@Rich-T-kid Rich-T-kid Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im sure there are faster ways to do this. I looked up a few ways to do this and im not too familar with bit operations so I left is as a basic loop for now

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let boolean_buf = BooleanBuffer::new(mutable_buffer.into(), 0, len);
BooleanArray::new(boolean_buf, self.nulls)
}
Err(buf) => {
let mut builder = BooleanBufferBuilder::new(len);
builder.append_buffer(&BooleanBuffer::new(buf, 0, end));
builder.append_n(len - end, false);
BooleanArray::new(builder.finish(), self.nulls)
}
}
}

/// Deconstruct this array into its constituent parts
Expand Down
Loading