Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Looks like we're missing BinaryView
|
match array.data_type() { |
|
DataType::List(_) => { |
|
let list = array.as_list::<i32>(); |
|
Ok(bit_length_impl::<Int32Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::LargeList(_) => { |
|
let list = array.as_list::<i64>(); |
|
Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::Utf8 => { |
|
let list = array.as_string::<i32>(); |
|
Ok(bit_length_impl::<Int32Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::LargeUtf8 => { |
|
let list = array.as_string::<i64>(); |
|
Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::Utf8View => { |
|
let list = array.as_string_view(); |
|
let values = list |
|
.views() |
|
.iter() |
|
.map(|view| (*view as i32).wrapping_mul(8)) |
|
.collect(); |
|
Ok(Arc::new(Int32Array::try_new( |
|
values, |
|
array.nulls().cloned(), |
|
)?)) |
|
} |
|
DataType::Binary => { |
|
let list = array.as_binary::<i32>(); |
|
Ok(bit_length_impl::<Int32Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::LargeBinary => { |
|
let list = array.as_binary::<i64>(); |
|
Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls())) |
|
} |
|
DataType::FixedSizeBinary(len) => Ok(Arc::new(Int32Array::try_new( |
|
vec![*len * 8; array.len()].into(), |
|
array.nulls().cloned(), |
|
)?)), |
|
other => Err(ArrowError::ComputeError(format!( |
|
"bit_length not supported for {other:?}" |
|
))), |
Describe the solution you'd like
Describe alternatives you've considered
Additional context
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Looks like we're missing
BinaryViewarrow-rs/arrow-string/src/length.rs
Lines 123 to 166 in 181007d
Describe the solution you'd like
Describe alternatives you've considered
Additional context