vortex_compute/arrow/
bool.rs1use arrow_array::Array;
5use arrow_array::BooleanArray;
6use vortex_buffer::BitBuffer;
7use vortex_error::VortexResult;
8use vortex_vector::bool::BoolVector;
9
10use crate::arrow::IntoArrow;
11use crate::arrow::IntoVector;
12use crate::arrow::nulls_to_mask;
13
14impl IntoArrow for BoolVector {
15 type Output = BooleanArray;
16
17 fn into_arrow(self) -> VortexResult<Self::Output> {
18 let (bits, validity) = self.into_parts();
19 Ok(BooleanArray::new(bits.into(), validity.into()))
20 }
21}
22
23impl IntoVector for &BooleanArray {
24 type Output = BoolVector;
25
26 fn into_vector(self) -> VortexResult<Self::Output> {
27 let bits = BitBuffer::from(self.values().clone());
28 let validity = nulls_to_mask(self.nulls(), self.len());
29 Ok(BoolVector::new(bits, validity))
30 }
31}