refactor: implement From<ArrayRef>

pull/24376/head
Edd Robinson 2021-01-11 13:57:53 +00:00
parent 9eef7b4d7f
commit 9ec0ae26e1
2 changed files with 6 additions and 4 deletions

View File

@ -2727,10 +2727,12 @@ impl<'a> Values<'a> {
},
}
}
}
// Moves ownership of self into an Arrow array.
pub fn take_arrow_array(self) -> array::ArrayRef {
match self {
/// Moves ownership of Values into an arrow `ArrayRef`.
impl From<Values<'_>> for array::ArrayRef {
fn from(values: Values<'_>) -> Self {
match values {
Values::String(values) => Arc::new(arrow::array::StringArray::from(values)),
Values::I64(values) => Arc::new(arrow::array::Int64Array::from(values)),
Values::U64(values) => Arc::new(arrow::array::UInt64Array::from(values)),

View File

@ -1112,7 +1112,7 @@ impl ReadFilterResult<'_> {
let columns = self
.data
.into_iter()
.map(|values| values.take_arrow_array())
.map(arrow::array::ArrayRef::from)
.collect::<Vec<_>>();
// try_new only returns an error if the schema is invalid or the number