scovich commented on code in PR #9159:
URL: https://github.com/apache/arrow-rs/pull/9159#discussion_r2687258020
##########
arrow-array/src/array/boolean_array.rs:
##########
@@ -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");
Review Comment:
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)
--
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]