pub struct PageIndexBuilder {
column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>,
offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>,
}Expand description
Builder for constructing PageIndex structures
It supports:
- Populating column indexes for predicate columns (for page filtering)
- Populating offset indexes for projected columns (for direct I/O)
- Automatic conversion of empty structures to
Noneto save memory
Fields§
§column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>§offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>Implementations§
Source§impl PageIndexBuilder
impl PageIndexBuilder
Sourcefn empty_index<T>(
num_row_groups: usize,
num_columns: usize,
) -> Option<Vec<Vec<Option<T>>>>
fn empty_index<T>( num_row_groups: usize, num_columns: usize, ) -> Option<Vec<Vec<Option<T>>>>
Creates an empty index structure with space for the specified number of row groups and columns
Returns Some containing a nested vector structure where all entries are initialized to None.
The outer vector has one entry per row group, and each inner vector has one entry per column.
§Type Parameters
T- The type of index this is to be, eitherColumnIndexMetaDataorOffsetIndexMetaData
Sourcepub fn new(num_row_groups: usize, num_columns: usize) -> Self
pub fn new(num_row_groups: usize, num_columns: usize) -> Self
Creates a new PageIndexBuilder with space allocated for both column and offset indexes
This allocates empty index structures for the specified number of row groups and columns.
All index entries are initialized to None and can be populated using
put_column_index and put_offset_index.
Sourcepub(crate) fn new_from(page_index: PageIndex) -> Self
pub(crate) fn new_from(page_index: PageIndex) -> Self
Creates a new PageIndexBuilder from an existing PageIndex
This takes ownership of the index structures from the provided PageIndex,
allowing them to be modified and rebuilt. Useful for updating existing page indexes.
Sourcepub fn allocate_column_indexes(
&mut self,
num_row_groups: usize,
num_columns: usize,
)
pub fn allocate_column_indexes( &mut self, num_row_groups: usize, num_columns: usize, )
Allocates space for column indexes
This allocates an empty index structure for the specified number of row groups and columns.
All index entries are initialized to None and can be populated using
put_column_index.
This can be used to add column index storage to a builder that lacks one
(either a Default builder, or one created from a PageIndex without column indexes).
Sourcepub fn allocate_offset_indexes(
&mut self,
num_row_groups: usize,
num_columns: usize,
)
pub fn allocate_offset_indexes( &mut self, num_row_groups: usize, num_columns: usize, )
Allocates space for offset indexes
This allocates an empty index structure for the specified number of row groups and columns.
All index entries are initialized to None and can be populated using
put_offset_index.
This can be used to add offset index storage to a builder that lacks one
(either a Default builder, or one created from a PageIndex without offset indexes).
Sourcepub fn put_column_index(
&mut self,
column_index: ColumnIndexMetaData,
row_group_idx: usize,
column_idx: usize,
)
pub fn put_column_index( &mut self, column_index: ColumnIndexMetaData, row_group_idx: usize, column_idx: usize, )
Sets the column index for a specific row group and column
If column indexes were not allocated (see Self::allocate_column_indexes),
or the row group or column index is out of bounds, this method does nothing.
Sourcepub fn put_offset_index(
&mut self,
offset_index: OffsetIndexMetaData,
row_group_idx: usize,
column_idx: usize,
)
pub fn put_offset_index( &mut self, offset_index: OffsetIndexMetaData, row_group_idx: usize, column_idx: usize, )
Sets the offset index for a specific row group and column
If offset indexes were not allocated (see Self::allocate_offset_indexes),
or the row group or column index is out of bounds, this method does nothing.
Sourcefn is_empty_index<T>(index: Option<&Vec<Vec<Option<T>>>>) -> bool
fn is_empty_index<T>(index: Option<&Vec<Vec<Option<T>>>>) -> bool
Checks if an index structure is entirely empty (all entries are None)
Sourcepub fn build(self) -> PageIndex
pub fn build(self) -> PageIndex
Consumes the builder and returns a PageIndex
If an index structure was allocated but remains entirely empty (all entries are None),
it will be converted to None in the final PageIndex. This ensures that:
- Empty structures don’t consume memory unnecessarily
PageIndex::has_column_indexes()andPageIndex::has_offset_indexes()correctly returnfalsefor unpopulated indexes