use crate::errors::ParquetError;
use crate::format::{OffsetIndex, PageLocation};
#[derive(Debug, Clone, PartialEq)]
pub struct OffsetIndexMetaData {
pub page_locations: Vec<PageLocation>,
pub unencoded_byte_array_data_bytes: Option<Vec<i64>>,
}
impl OffsetIndexMetaData {
pub(crate) fn try_new(index: OffsetIndex) -> Result<Self, ParquetError> {
Ok(Self {
page_locations: index.page_locations,
unencoded_byte_array_data_bytes: index.unencoded_byte_array_data_bytes,
})
}
pub fn page_locations(&self) -> &Vec<PageLocation> {
&self.page_locations
}
pub fn unencoded_byte_array_data_bytes(&self) -> Option<&Vec<i64>> {
self.unencoded_byte_array_data_bytes.as_ref()
}
#[allow(dead_code)]
pub(crate) fn to_thrift(&self) -> OffsetIndex {
OffsetIndex::new(
self.page_locations.clone(),
self.unencoded_byte_array_data_bytes.clone(),
)
}
}