Skip to content

Commit

Permalink
Prevent inspect the string data
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Liu <[email protected]>
  • Loading branch information
austin362667 committed Nov 4, 2024
1 parent a3650ef commit 098cf3e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arrow-string/src/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,15 @@ pub fn bit_length(array: &dyn Array) -> Result<ArrayRef, ArrowError> {
let list = array.as_string::<i64>();
Ok(bit_length_impl::<Int64Type>(list.offsets(), list.nulls()))
}
DataType::Utf8View => Ok(Arc::new(Int32Array::from_unary(
array.as_string_view(),
|x| i32::mul_wrapping(x.bytes().len() as i32, 8),
))),
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::new(values, array.nulls().cloned())))
}
DataType::Binary => {
let list = array.as_binary::<i32>();
Ok(bit_length_impl::<Int32Type>(list.offsets(), list.nulls()))
Expand Down

0 comments on commit 098cf3e

Please sign in to comment.