Skip to main content

CategoricalColumn

Struct CategoricalColumn 

Source
pub struct CategoricalColumn { /* private fields */ }
Expand description

A categorical column: a vector of codes pointing into a shared ByteDictionary, plus an optional null bitmap.

§Invariant

codes.len() == nrows. If nulls is present, nulls.nrows() == nrows. A row is valid iff nulls.is_none() || nulls.unwrap().get(i). (A 1 bit means valid — same convention as BitMask elsewhere in cjc-data.)

§Equality

Two CategoricalColumns are deep-equal iff they have the same codes, same dictionary contents (including ordering), and same null pattern.

Implementations§

Source§

impl CategoricalColumn

Source

pub fn new() -> Self

Empty column with a fresh FirstSeen dictionary.

Source

pub fn with_dictionary(dictionary: ByteDictionary) -> Self

Empty column with the given dictionary (used to share a dictionary across columns or to seed with Explicit ordering).

Source

pub fn len(&self) -> usize

Number of rows.

Source

pub fn is_empty(&self) -> bool

True if no rows.

Source

pub fn dictionary(&self) -> &ByteDictionary

Read-only access to the dictionary.

Source

pub fn codes(&self) -> &AdaptiveCodes

Read-only access to the codes.

Source

pub fn nulls(&self) -> Option<&BitMask>

Read-only access to the null bitmap if present.

Source

pub fn is_null(&self, i: usize) -> bool

True if the row at index i is null.

Source

pub fn push(&mut self, bytes: &[u8]) -> Result<u64, ByteDictError>

Append a non-null value, interning it in the dictionary.

Returns the assigned code.

Source

pub fn push_null(&mut self)

Append a null. Allocates the null bitmap on first call if absent.

Source

pub fn push_with_policy( &mut self, bytes: &[u8], policy: &UnknownCategoryPolicy, ) -> Result<(), ByteDictError>

Append a value with explicit unknown-policy handling. If the policy returns InternedCode::Null, the row is recorded as null.

Source

pub fn get(&self, i: usize) -> Option<&[u8]>

Resolve the bytes for row i. Returns None if the row is null.

Source

pub fn iter(&self) -> impl Iterator<Item = (usize, Option<&[u8]>)> + '_

Iterate (row_index, Option<bytes>). Deterministic.

Source

pub fn seal_lexical(&mut self)

Run seal_lexical on the dictionary and rewrite the codes. After this call the dictionary’s iteration order is byte-lex; the codes are remapped accordingly. Bit-identical results regardless of insertion order.

Source

pub fn profile(&self) -> CategoricalProfile

Build a CategoricalProfile summarising this column. Internal stats only; not exposed as a language-level builtin in Phase 1.

Trait Implementations§

Source§

impl Clone for CategoricalColumn

Source§

fn clone(&self) -> CategoricalColumn

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CategoricalColumn

Source§

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

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

impl Default for CategoricalColumn

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.