pub struct TableV {
pub name: String,
pub fields: Vec<Arc<Field>>,
pub cols: Vec<ArrayV>,
pub offset: usize,
pub len: usize,
pub active_col_selection: Option<Vec<usize>>,
}Expand description
§TableView
Row-aligned view into a Table over [offset .. offset+len).
§Fields
name: table name, propagated from the parentTable.fields: shared schema, oneArc<Field>per column.cols: column windows asArrayV, all with the same(offset, len).offset: starting row, relative to parent table.len: number of rows in the window.active_col_selection: optional column selection indices for lazy column filtering. When set, access methods transparently return only the selected columns. Row windowing is handled byoffset/len.
§Notes
- Construction from a
Table/Arc<Table>is zero-copy for column data. - Use
from_selfto take sub-windows cheaply. - Use
to_table()to materialise an owned copy of just this window. - Column helpers (
col,col_ix,col_vec) provide ergonomic access. - When
active_col_selectionis set, all access methods filter transparently. The underlyingfieldsandcolsvectors retain the full schema so that selections can be composed or cleared without reallocating.
Fields§
§name: StringTable name
fields: Vec<Arc<Field>>Full schema - one entry per column in the parent table
cols: Vec<ArrayV>Full column windows - one ArrayV per column, all with the same (offset, len)
offset: usizeRow offset from start of parent table
len: usizeNumber of rows in the window
active_col_selection: Option<Vec<usize>>Lazy column selection. When Some, only these indices into fields/cols
are considered active. Access methods, iteration, and materialisation
all filter through this selection transparently.
Implementations§
Source§impl TableV
impl TableV
Sourcepub fn from_table(table: Table, offset: usize, len: usize) -> TableV
pub fn from_table(table: Table, offset: usize, len: usize) -> TableV
Creates a new TableView over table[offset .. offset+len).
Provides a non-owning view into a subrange of the table.
Sourcepub fn from_arc_table(table: Arc<Table>, offset: usize, len: usize) -> TableV
pub fn from_arc_table(table: Arc<Table>, offset: usize, len: usize) -> TableV
Creates a new TableView over table[offset .. offset+len).
Provides a non-owning view into a subrange of the table.
Sourcepub fn from_self(&self, offset: usize, len: usize) -> TableV
pub fn from_self(&self, offset: usize, len: usize) -> TableV
Derives a subwindow from this TableView, adjusted by offset and len.
Preserves the active column selection from the parent view.
Sourcepub fn clear_col_selection(&mut self)
pub fn clear_col_selection(&mut self)
Clear the active column selection, making all columns active again.
Sourcepub fn active_col_indices(&self) -> Vec<usize>
pub fn active_col_indices(&self) -> Vec<usize>
Returns the active column indices, or all indices if no selection is set.
Sourcepub fn has_col_selection(&self) -> bool
pub fn has_col_selection(&self) -> bool
Returns true if a column selection is active.
Sourcepub fn rename_columns(
&mut self,
mapping: &[(&str, &str)],
) -> Result<(), MinarrowError>
pub fn rename_columns( &mut self, mapping: &[(&str, &str)], ) -> Result<(), MinarrowError>
Rename columns in place. Each pair is (old_name, new_name).
Only searches active columns when a selection is set. Returns an error if any old name is not found among active columns. This is metadata-only - array data is not touched.
Sourcepub fn col_name_index(&self, name: &str) -> Option<usize>
pub fn col_name_index(&self, name: &str) -> Option<usize>
Returns the position of a column by name within the active selection.
Sourcepub fn col_window(&self, idx: usize) -> Option<ArrayV>
pub fn col_window(&self, idx: usize) -> Option<ArrayV>
Returns the window of the column at the given active index.
Sourcepub fn col_name(&self, idx: usize) -> Option<&str>
pub fn col_name(&self, idx: usize) -> Option<&str>
Returns the name of the column at the given active index.
Sourcepub fn nullable_cols(&self) -> Vec<bool>
pub fn nullable_cols(&self) -> Vec<bool>
Returns a Vec<bool> indicating which active columns are nullable.
Sourcepub fn to_table(&self) -> Table
pub fn to_table(&self) -> Table
Materialise the view into an owned Table. Respects active column selection.
Sourcepub fn apply_cols<E>(
&self,
f: impl FnMut(&Arc<Field>, &ArrayV) -> Result<FieldArray, E>,
) -> Result<Table, E>
pub fn apply_cols<E>( &self, f: impl FnMut(&Arc<Field>, &ArrayV) -> Result<FieldArray, E>, ) -> Result<Table, E>
Apply a transformation to each active column view, producing a new table.
The closure receives the field and column view directly without
materialisation. To pass a column through unchanged, materialise
with view.to_array(). To transform, operate on the view and
return the result as a FieldArray.
Sourcepub fn extract_column(field: &Field, window: &ArrayV) -> FieldArray
pub fn extract_column(field: &Field, window: &ArrayV) -> FieldArray
Converts a column window into an owned FieldArray, slicing the array and copying data.
Copies the data.
Sourcepub fn gather_rows(&self, indices: &[usize]) -> Table
pub fn gather_rows(&self, indices: &[usize]) -> Table
Gather specific row indices from this view into a materialised Table. Indices are relative to this view’s window.
Trait Implementations§
Source§impl ColumnSelection for TableV
Available on crate feature select only.
impl ColumnSelection for TableV
select only.Source§type ColumnView = ArrayV
type ColumnView = ArrayV
Source§type ColumnOwned = FieldArray
type ColumnOwned = FieldArray
.get() e.g. FieldArray for Table, Arc