Skip to main content

PageIndexBuilder

Struct PageIndexBuilder 

Source
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 None to save memory

Fields§

§column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>§offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>

Implementations§

Source§

impl PageIndexBuilder

Source

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, either ColumnIndexMetaData or OffsetIndexMetaData
Source

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.

Source

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.

Source

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).

Source

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).

Source

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.

Source

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.

Source

fn is_empty_index<T>(index: Option<&Vec<Vec<Option<T>>>>) -> bool

Checks if an index structure is entirely empty (all entries are None)

Source

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:

Trait Implementations§

Source§

impl Default for PageIndexBuilder

Source§

fn default() -> PageIndexBuilder

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

impl From<PageIndex> for PageIndexBuilder

Source§

fn from(page_index: PageIndex) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Ungil for T
where T: Send,