Skip to main content

Column

Enum Column 

Source
pub enum Column {
    Numeric {
        values: Vec<f64>,
        validity: ValidityBitmap,
    },
    Boolean {
        values: Vec<bool>,
        validity: ValidityBitmap,
    },
    Categorical {
        dictionary: Vec<String>,
        indices: Vec<u32>,
        validity: ValidityBitmap,
    },
    Text {
        values: Vec<String>,
        validity: ValidityBitmap,
    },
}
Expand description

A typed column with validity bitmap for missing values.

All variants store values in a dense array alongside a ValidityBitmap. Invalid positions hold a default value (0.0, false, empty string, or index 0) that should be ignored.

Variants§

§

Numeric

Dense f64 values. Null positions hold 0.0.

Fields

§values: Vec<f64>
§

Boolean

Boolean values. Null positions hold false.

Fields

§values: Vec<bool>
§

Categorical

Dictionary-encoded categorical column.

dictionary contains unique string values. indices maps each row to a dictionary index. Null positions have index 0 (ignored via validity bit).

Fields

§dictionary: Vec<String>
§indices: Vec<u32>
§

Text

Free-form text column. Null positions hold an empty string.

Fields

§values: Vec<String>

Implementations§

Source§

impl Column

Source

pub fn numeric(values: Vec<f64>, validity: ValidityBitmap) -> Self

Creates a numeric column.

Source

pub fn boolean(values: Vec<bool>, validity: ValidityBitmap) -> Self

Creates a boolean column.

Source

pub fn categorical( dictionary: Vec<String>, indices: Vec<u32>, validity: ValidityBitmap, ) -> Self

Creates a categorical column from a dictionary and indices.

Source

pub fn text(values: Vec<String>, validity: ValidityBitmap) -> Self

Creates a text column.

Source

pub fn data_type(&self) -> DataType

Returns the data type of this column.

Source

pub fn len(&self) -> usize

Returns the number of rows in this column.

Source

pub fn is_empty(&self) -> bool

Returns true if the column has no rows.

Source

pub fn validity(&self) -> &ValidityBitmap

Returns a reference to the validity bitmap.

Source

pub fn null_count(&self) -> usize

Returns the number of null values.

Source

pub fn valid_count(&self) -> usize

Returns the number of valid (non-null) values.

Source

pub fn is_valid(&self, idx: usize) -> bool

Returns true if the value at idx is valid (not null).

Source

pub fn as_numeric(&self) -> Option<&[f64]>

Returns the numeric values, or None if not a numeric column.

Source

pub fn as_boolean(&self) -> Option<&[bool]>

Returns the boolean values, or None if not a boolean column.

Source

pub fn valid_numeric_values(&self) -> Option<Vec<f64>>

Returns valid numeric values (nulls excluded) as a new Vec<f64>.

Source

pub fn category_at(&self, idx: usize) -> Option<&str>

Returns the category string for a given row index in a categorical column.

Source

pub fn text_at(&self, idx: usize) -> Option<&str>

Returns the text value for a given row index in a text column.

Trait Implementations§

Source§

impl Clone for Column

Source§

fn clone(&self) -> Column

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Column

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Column

Source§

fn eq(&self, other: &Column) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Column

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V