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
impl PageIndex
pub(crate) fn new( column_indexes: Option<Vec<Vec<Option<ColumnIndexMetaData>>>>, offset_indexes: Option<Vec<Vec<Option<OffsetIndexMetaData>>>>, ) -> Self
Sourcepub fn into_builder(self) -> PageIndexBuilder
pub fn into_builder(self) -> PageIndexBuilder
Convert this PageIndex into a PageIndexBuilder
Sourcepub(crate) fn column_indexes_raw(
&self,
) -> Option<&Vec<Vec<Option<ColumnIndexMetaData>>>>
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.
Sourcepub(crate) fn offset_indexes_raw(
&self,
) -> Option<&Vec<Vec<Option<OffsetIndexMetaData>>>>
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 From<PageIndex> for PageIndexBuilder
impl From<PageIndex> for PageIndexBuilder
Source§impl PageIndexProvider for PageIndex
impl PageIndexProvider for PageIndex
Source§fn has_offset_indexes(&self) -> bool
fn has_offset_indexes(&self) -> bool
true if offset index structures are available via this provider Read moreSource§fn has_column_indexes(&self) -> bool
fn has_column_indexes(&self) -> bool
true if column index structures are available via this provider Read moreSource§fn column_index(
&self,
row_group_idx: usize,
column_idx: usize,
) -> Option<&ColumnIndexMetaData>
fn column_index( &self, row_group_idx: usize, column_idx: usize, ) -> Option<&ColumnIndexMetaData>
Source§fn offset_index(
&self,
row_group_idx: usize,
column_idx: usize,
) -> Option<&OffsetIndexMetaData>
fn offset_index( &self, row_group_idx: usize, column_idx: usize, ) -> Option<&OffsetIndexMetaData>
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
&dyn Any for downcasting Read moreSource§fn is_complete(&self) -> bool
fn is_complete(&self) -> bool
true if both the offset and column index structures are present Read more