Skip to main content

PageIndexBuilder

Struct PageIndexBuilder 

Source
pub struct PageIndexBuilder {
    column_indexes: Option<ColumnChunkMap<ColumnIndexMetaData>>,
    offset_indexes: Option<ColumnChunkMap<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<ColumnChunkMap<ColumnIndexMetaData>>§offset_indexes: Option<ColumnChunkMap<OffsetIndexMetaData>>

Implementations§

Source§

impl PageIndexBuilder

Source

pub fn new(num_row_groups: usize, num_columns: usize) -> Self

Creates a new PageIndexBuilder for the specified number of row groups and columns.

The dimensions are used to validate inserted coordinates. Storage is allocated only for entries populated using try_put_column_index and try_put_offset_index.

§Panics

Panics if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

Use try_new for a fallible alternative.

Source

pub fn try_new(num_row_groups: usize, num_columns: usize) -> Result<Self>

Attempts to create a new PageIndexBuilder for the specified number of row groups and columns.

§Errors

Returns an error if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

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

fn try_new_from(page_index: PageIndex) -> Result<Self>

Source

pub fn allocate_column_indexes( &mut self, num_row_groups: usize, num_columns: usize, )

Allocates space for column indexes

This replaces any existing column indexes with an empty sparse map having the specified dimensions. It can then be populated using try_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).

§Panics

Panics if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

Use try_allocate_column_indexes for a fallible alternative.

Source

pub fn try_allocate_column_indexes( &mut self, num_row_groups: usize, num_columns: usize, ) -> Result<()>

Attempts to allocate space for column indexes

This is a fallible version of allocate_column_indexes.

§Errors

Returns an error if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

Source

pub fn allocate_offset_indexes( &mut self, num_row_groups: usize, num_columns: usize, )

Allocates space for offset indexes

This replaces any existing offset indexes with an empty sparse map having the specified dimensions. It can then be populated using try_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).

§Panics

Panics if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

Use try_allocate_offset_indexes for a fallible alternative.

Source

pub fn try_allocate_offset_indexes( &mut self, num_row_groups: usize, num_columns: usize, ) -> Result<()>

Attempts to allocate space for offset indexes

This is a fallible version of allocate_offset_indexes.

§Errors

Returns an error if either dimension exceeds i32::MAX, the maximum collection size representable by Thrift.

Source

pub fn put_column_index( &mut self, column_index: ColumnIndexMetaData, row_group_idx: usize, column_idx: usize, )

👎Deprecated since 60.2.0:

Use try_put_column_index to detect invalid coordinates or unavailable index storage

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 try_put_column_index( &mut self, column_index: ColumnIndexMetaData, row_group_idx: usize, column_idx: usize, ) -> Result<()>

Attempts to set the column index for a specific row group and column.

§Errors

Returns an error, and drops column_index, if column indexes were not allocated or the coordinate is out of bounds.

Source

pub fn put_offset_index( &mut self, offset_index: OffsetIndexMetaData, row_group_idx: usize, column_idx: usize, )

👎Deprecated since 60.2.0:

Use try_put_offset_index to detect invalid coordinates or unavailable index storage

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

pub fn try_put_offset_index( &mut self, offset_index: OffsetIndexMetaData, row_group_idx: usize, column_idx: usize, ) -> Result<()>

Attempts to set the offset index for a specific row group and column.

§Errors

Returns an error, and drops offset_index, if offset indexes were not allocated or the coordinate is out of bounds.

Source

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

Checks if an index structure is entirely empty.

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:

Source

pub fn try_build(self) -> Result<PageIndex>

Fallibly consumes the builder and returns a PageIndex.

Trait Implementations§

Source§

impl Debug for PageIndexBuilder

Source§

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

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

impl Default for PageIndexBuilder

Source§

fn default() -> Self

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,