Skip to main content

PageIndex

Struct PageIndex 

Source
pub struct PageIndex {
    column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>,
    offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>,
}
Expand description

Struct to encapsulate the Parquet Page Index

This struct provides a dense representation of the Page Index. It is used internally by this crate when assembling and writing the Page Index. It is also the default implementation of the PageIndexProvider contained in the ParquetMetaData.

§Example: Constructing a synthetic PageIndex

This example builds a ParquetMetaData for a file with a single row group containing a single BYTE_ARRAY column with one data page, and attaches a matching PageIndex, as might be done in tests that exercise page-level statistics handling.

// Create metadata for a file with a single row group containing a
// single BYTE_ARRAY column "s" with three values
let file_metadata = FileMetaData::new(1, 3, None, None, schema, None);
let metadata = ParquetMetaData::new(file_metadata, vec![row_group]);

// Build a column index with min/max statistics for the single page
let mut column_index = ColumnIndexBuilder::new(PhysicalType::BYTE_ARRAY);
column_index.append(false, b"az".to_vec(), b"b".to_vec(), 0, None);
column_index.set_boundary_order(BoundaryOrder::ASCENDING);
let column_index = column_index.build().unwrap();

// Build an offset index recording the location of the single page
let mut offset_index = OffsetIndexBuilder::new();
offset_index.append_row_count(3);
offset_index.append_offset_and_size(4, 100);
let offset_index = offset_index.build();

// Assemble the PageIndex (one entry per row group, each with one
// entry per column) and attach it to the metadata
let mut page_index = PageIndexBuilder::new(1, 1);
page_index.put_column_index(column_index, 0, 0);
page_index.put_offset_index(offset_index, 0, 0);
let page_index = page_index.build();
let metadata = metadata
    .into_builder()
    .set_page_index(Some(Arc::new(page_index)))
    .build();
assert!(metadata.page_index().unwrap().is_complete());

Fields§

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

Implementations§

Source§

impl PageIndex

Source

pub(crate) fn new( column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>, offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>, ) -> Self

Source

pub fn into_builder(self) -> PageIndexBuilder

Convert this PageIndex into a PageIndexBuilder

Source

pub(crate) fn column_indexes_raw( &self, ) -> Option<&Vec<Vec<Option<ColumnIndexMetaData>>>>

Returns a reference to the raw column indexes structure

This method provides access to the underlying column index data for serialization and other low-level operations.

Source

pub(crate) fn offset_indexes_raw( &self, ) -> Option<&Vec<Vec<Option<OffsetIndexMetaData>>>>

Returns a reference to the raw offset indexes structure

This method provides access to the underlying offset index data for serialization and other low-level operations.

Trait Implementations§

Source§

impl Clone for PageIndex

Source§

fn clone(&self) -> PageIndex

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PageIndex

Source§

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

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

impl From<PageIndex> for PageIndexBuilder

Source§

fn from(page_index: PageIndex) -> Self

Converts to this type from the input type.
Source§

impl HeapSize for PageIndex

Source§

fn heap_size(&self) -> usize

Return the size of any bytes allocated on the heap by this object, including heap memory in those structures Read more
Source§

impl PageIndexProvider for PageIndex

Source§

fn has_offset_indexes(&self) -> bool

Returns true if offset index structures are available via this provider Read more
Source§

fn has_column_indexes(&self) -> bool

Returns true if column index structures are available via this provider Read more
Source§

fn column_index( &self, row_group_idx: usize, column_idx: usize, ) -> Option<&ColumnIndexMetaData>

Returns the column index for a specific row group and column Read more
Source§

fn offset_index( &self, row_group_idx: usize, column_idx: usize, ) -> Option<&OffsetIndexMetaData>

Returns the offset index for a specific row group and column Read more
Source§

fn as_any(&self) -> &dyn Any

Returns a reference to the trait object as &dyn Any for downcasting Read more
Source§

fn is_complete(&self) -> bool

Returns true if both the offset and column index structures are present Read more
Source§

fn num_data_pages( &self, row_group_idx: usize, column_idx: usize, ) -> Option<usize>

Returns the expected number of data pages for a specific column chunk Read more
Source§

fn page_locations( &self, row_group_idx: usize, column_idx: usize, ) -> Option<&Vec<PageLocation>>

Returns the physical locations of all data pages in a column chunk Read more
Source§

impl PartialEq for PageIndex

Source§

fn eq(&self, other: &PageIndex) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PageIndex

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,