pub trait DataTypeExt {
// Required methods
fn is_binary_like(&self) -> bool;
fn is_struct(&self) -> bool;
fn is_fixed_stride(&self) -> bool;
fn is_dictionary(&self) -> bool;
fn byte_width(&self) -> usize;
fn byte_width_opt(&self) -> Option<usize>;
}
Required Methods§
Sourcefn is_binary_like(&self) -> bool
fn is_binary_like(&self) -> bool
Returns true if the data type is binary-like, such as (Large)Utf8 and (Large)Binary.
use lance_arrow::*;
use arrow_schema::DataType;
assert!(DataType::Utf8.is_binary_like());
assert!(DataType::Binary.is_binary_like());
assert!(DataType::LargeUtf8.is_binary_like());
assert!(DataType::LargeBinary.is_binary_like());
assert!(!DataType::Int32.is_binary_like());
Sourcefn is_fixed_stride(&self) -> bool
fn is_fixed_stride(&self) -> bool
Check whether the given Arrow DataType is fixed stride.
A fixed stride type has the same byte width for all array elements This includes all PrimitiveType’s Boolean, FixedSizeList, FixedSizeBinary, and Decimals
Sourcefn is_dictionary(&self) -> bool
fn is_dictionary(&self) -> bool
Returns true if the DataType is a dictionary type.
Sourcefn byte_width(&self) -> usize
fn byte_width(&self) -> usize
Returns the byte width of the data type Panics if the data type is not fixed stride.
Sourcefn byte_width_opt(&self) -> Option<usize>
fn byte_width_opt(&self) -> Option<usize>
Returns the byte width of the data type, if it is fixed stride. Returns None if the data type is not fixed stride.