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; // For use in `varbinview`.
9
10mod vtable;
11pub use vtable::{VarBinEncoding, VarBinVTable};
12
13pub mod builder;
14
15mod accessor;
16mod operator;
17
18use vortex_buffer::ByteBuffer;
19use vortex_dtype::DType;
20use vortex_error::{VortexUnwrap, vortex_err};
21use vortex_scalar::Scalar;
22
23pub fn varbin_scalar(value: ByteBuffer, dtype: &DType) -> Scalar {
24    if matches!(dtype, DType::Utf8(_)) {
25        Scalar::try_utf8(value, dtype.nullability())
26            .map_err(|err| vortex_err!("Failed to create scalar from utf8 buffer: {}", err))
27            .vortex_unwrap()
28    } else {
29        Scalar::binary(value, dtype.nullability())
30    }
31}
32
33#[cfg(test)]
34mod tests;