vortex_array/arrays/varbin/
mod.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4mod array;
5pub use array::VarBinArray;
6
7mod compute;
8pub(crate) use compute::varbin_compute_min_max;
9// For use in `varbinview`.
10
11mod vtable;
12pub use vtable::VarBinVTable;
13
14pub mod builder;
15
16mod accessor;
17
18use vortex_buffer::ByteBuffer;
19use vortex_dtype::DType;
20use vortex_error::VortexUnwrap;
21use vortex_error::vortex_err;
22use vortex_scalar::Scalar;
23
24pub fn varbin_scalar(value: ByteBuffer, dtype: &DType) -> Scalar {
25    if matches!(dtype, DType::Utf8(_)) {
26        Scalar::try_utf8(value, dtype.nullability())
27            .map_err(|err| vortex_err!("Failed to create scalar from utf8 buffer: {}", err))
28            .vortex_unwrap()
29    } else {
30        Scalar::binary(value, dtype.nullability())
31    }
32}
33
34#[cfg(test)]
35mod tests;