Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shanisolomon committed Feb 20, 2022
1 parent ecba7dc commit 9aea0e4
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions parquet/src/file/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,32 +428,21 @@ impl ColumnChunkMetaData {
self.data_page_offset
}

/// Returns `true` if this column chunk contains a index page, `false` otherwise.
pub fn has_index_page(&self) -> bool {
self.index_page_offset.is_some()
}

/// Returns the offset for the index page.
pub fn index_page_offset(&self) -> Option<i64> {
self.index_page_offset
}

/// Returns `true` if this column chunk contains a dictionary page, `false` otherwise.
pub fn has_dictionary_page(&self) -> bool {
self.dictionary_page_offset.is_some()
}

/// Returns the offset for the dictionary page, if any.
pub fn dictionary_page_offset(&self) -> Option<i64> {
self.dictionary_page_offset
}

/// Returns the offset and length in bytes of the column chunk within the file
pub fn byte_range(&self) -> (u64, u64) {
let col_start = if self.has_dictionary_page() {
self.dictionary_page_offset().unwrap()
} else {
self.data_page_offset()
let col_start = match self.dictionary_page_offset() {
Some(dictionary_page_offset) => dictionary_page_offset,
None => self.data_page_offset(),
};
let col_len = self.compressed_size();
assert!(
Expand Down

0 comments on commit 9aea0e4

Please sign in to comment.