Skip to content

Commit

Permalink
Fix panic when reading file with no row groups (#408)
Browse files Browse the repository at this point in the history
  • Loading branch information
bprosnitz authored Nov 15, 2022
1 parent 24e17d6 commit bcdc457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ func OpenFile(r io.ReaderAt, size int64, options ...FileOption) (*File, error) {
// this case the page index is not cached within the file, programs are expected
// to make use of independently from the parquet package.
func (f *File) ReadPageIndex() ([]format.ColumnIndex, []format.OffsetIndex, error) {
if len(f.metadata.RowGroups) == 0 {
return nil, nil, nil
}

columnIndexOffset := f.metadata.RowGroups[0].Columns[0].ColumnIndexOffset
offsetIndexOffset := f.metadata.RowGroups[0].Columns[0].OffsetIndexOffset
columnIndexLength := int64(0)
Expand Down
Binary file added testdata/empty.parquet
Binary file not shown.

0 comments on commit bcdc457

Please sign in to comment.