Skip to content

Commit

Permalink
fix: avoid panic if offset index not exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
RinChanNOWWW committed Sep 1, 2023
1 parent eeba0a3 commit 8100a9f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion parquet/src/arrow/arrow_reader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ impl<T: ChunkReader + 'static> Iterator for ReaderPageIterator<T> {
let rg = self.metadata.row_group(rg_idx);
let meta = rg.column(self.column_idx);
let offset_index = self.metadata.offset_index();
let page_locations = offset_index.map(|i| i[rg_idx][self.column_idx].clone());
// `offset_index` may not exist and the inner `Vec` will be empty.
let page_locations = offset_index
.filter(|i| !i[rg_idx].is_empty())
.map(|i| i[rg_idx][self.column_idx].clone());
let total_rows = rg.num_rows() as usize;
let reader = self.reader.clone();

Expand Down

0 comments on commit 8100a9f

Please sign in to comment.