polars_compute/
size.rs

1
2
3
4
5
6
7
8
9
use arrow::array::{Array, ArrayRef, BinaryViewArray, UInt32Array};
use arrow::buffer::Buffer;
use arrow::datatypes::ArrowDataType;

pub fn binary_size_bytes(array: &BinaryViewArray) -> ArrayRef {
    let values: Buffer<_> = array.len_iter().collect();
    let array = UInt32Array::new(ArrowDataType::UInt32, values, array.validity().cloned());
    Box::new(array)
}