lance_arrow

Trait DataTypeExt

Source
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§

Source

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());
Source

fn is_struct(&self) -> bool

Returns true if the data type is a struct.

Source

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

Source

fn is_dictionary(&self) -> bool

Returns true if the DataType is a dictionary type.

Source

fn byte_width(&self) -> usize

Returns the byte width of the data type Panics if the data type is not fixed stride.

Source

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.

Implementations on Foreign Types§

Source§

impl DataTypeExt for DataType

Implementors§