-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PARQUET-2252: Make some methods public to allow external projects to … #1038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PARQUET-2252: Make some methods public to allow external projects to … #1038
Conversation
…implement page skipping.
|
@gszadovszky @shangxinli Do you have any concern? |
|
Since these are already used in iceberg I think it is better to have them public and maintain backward compatibility. |
|
|
||
| BlockMetaData block = blocks.get(blockIndex); | ||
| if (block.getRowCount() == 0L) { | ||
| throw new ParquetEmptyBlockException("Illegal row group of 0 rows"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the reader simply skips empty row groups instead of throw. Could you change this to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked PARQUET-2291, seems we only skip empty row group when using reader as a iterator, right? We skip empty row group in readNextRowGroup() , but not when the user passes in a blockIndex, and this newly introduced method also requires the user pass in a blockIndex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this would throw an exception. This method is intended to allow building an external iterator. I don't think anyone would ever want to fail if there were an empty row group, even if the reader thinks it shouldn't have been written. I think this should return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, readRowGroup(int blockIndex) and readFilteredRowGroup(int blockIndex) also throw an exception when handling empty row groups, should we make them also return null instead of throwing an exception to be consistent?
rdblue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks fine, but I agree that the row group count check should just return null instead of throwing an exception.
|
Thanks, @zhongyujiang! |
…implement page skipping.
Issue: PARQUET-2252
This PR makes some methods public(methods in
RowRangesandIndexIteratorfor calculatingRowRanges, andgetColumnIndexStoreinParquetFileReaderfor getting column index store), Iceberg needs these to build its own column index filtering. Since Iceberg is going to calculateRowRangesitself, this also adds a public method inParquetFileReaderthat allows users to pass inRowRangesto read filtered row group. Use of these changes can refer to this PR, currently it uses reflection as a workaround.