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
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
Returns
true if offset index structures are available via this provider Read moreSource§fn has_column_indexes(&self) -> bool
fn has_column_indexes(&self) -> bool
Returns
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>
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>
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
fn as_any(&self) -> &dyn Any
Returns a reference to the trait object as
&dyn Any for downcasting Read moreSource§fn is_complete(&self) -> bool
fn is_complete(&self) -> bool
Returns
true if both the offset and column index structures are present Read moreSource§fn num_data_pages(
&self,
row_group_idx: usize,
column_idx: usize,
) -> Option<usize>
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>>
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
impl StructuralPartialEq for PageIndex
Auto Trait Implementations§
impl Freeze for PageIndex
impl RefUnwindSafe for PageIndex
impl Send for PageIndex
impl Sync for PageIndex
impl Unpin for PageIndex
impl UnsafeUnpin for PageIndex
impl UnwindSafe for PageIndex
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more