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
impl CategoricalColumn
Sourcepub fn with_dictionary(dictionary: ByteDictionary) -> Self
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).
Sourcepub fn dictionary(&self) -> &ByteDictionary
pub fn dictionary(&self) -> &ByteDictionary
Read-only access to the dictionary.
Sourcepub fn codes(&self) -> &AdaptiveCodes
pub fn codes(&self) -> &AdaptiveCodes
Read-only access to the codes.
Sourcepub fn push(&mut self, bytes: &[u8]) -> Result<u64, ByteDictError>
pub fn push(&mut self, bytes: &[u8]) -> Result<u64, ByteDictError>
Append a non-null value, interning it in the dictionary.
Returns the assigned code.
Sourcepub fn push_with_policy(
&mut self,
bytes: &[u8],
policy: &UnknownCategoryPolicy,
) -> Result<(), ByteDictError>
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.
Sourcepub fn get(&self, i: usize) -> Option<&[u8]>
pub fn get(&self, i: usize) -> Option<&[u8]>
Resolve the bytes for row i. Returns None if the row is null.
Sourcepub fn iter(&self) -> impl Iterator<Item = (usize, Option<&[u8]>)> + '_
pub fn iter(&self) -> impl Iterator<Item = (usize, Option<&[u8]>)> + '_
Iterate (row_index, Option<bytes>). Deterministic.
Sourcepub fn seal_lexical(&mut self)
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.
Sourcepub fn profile(&self) -> CategoricalProfile
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
impl Clone for CategoricalColumn
Source§fn clone(&self) -> CategoricalColumn
fn clone(&self) -> CategoricalColumn
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CategoricalColumn
impl Debug for CategoricalColumn
Auto Trait Implementations§
impl Freeze for CategoricalColumn
impl RefUnwindSafe for CategoricalColumn
impl Send for CategoricalColumn
impl Sync for CategoricalColumn
impl Unpin for CategoricalColumn
impl UnsafeUnpin for CategoricalColumn
impl UnwindSafe for CategoricalColumn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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