Skip to content
Merged
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
17 changes: 7 additions & 10 deletions arrow-array/src/array/boolean_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,24 +389,21 @@ impl From<Vec<Option<bool>>> for BooleanArray {

impl From<ArrayData> for BooleanArray {
fn from(data: ArrayData) -> Self {
let (data_type, len, nulls, offset, mut buffers, _child_data) = data.into_parts();
assert_eq!(
data.data_type(),
&DataType::Boolean,
"BooleanArray expected ArrayData with type {} got {}",
data_type,
DataType::Boolean,
data.data_type()
"BooleanArray expected ArrayData with type Boolean got {data_type:?}",
);
assert_eq!(
data.buffers().len(),
buffers.len(),
1,
"BooleanArray data should contain a single buffer only (values buffer)"
);
let values = BooleanBuffer::new(data.buffers()[0].clone(), data.offset(), data.len());
let buffer = buffers.pop().expect("checked above");
Comment on lines 398 to +403
Copy link
Contributor

@scovich scovich Jan 13, 2026

Choose a reason for hiding this comment

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

aside: it's a bit annoying that we can't just do let [buffer] = buffers else { ... }

(let [buffer] = buffers[..] else { ... } produces a slice ref that would match but only capture a borrow instead of consuming it like we want here)

let values = BooleanBuffer::new(buffer, offset, len);

Self {
values,
nulls: data.nulls().cloned(),
}
Self { values, nulls }
}
}

Expand Down
Loading