Skip to content

Conversation

@zhongyujiang
Copy link
Contributor

@zhongyujiang zhongyujiang commented Mar 1, 2023

…implement page skipping.

Issue: PARQUET-2252

This PR makes some methods public(methods in RowRanges and IndexIterator for calculating RowRanges, and getColumnIndexStore in ParquetFileReader for getting column index store), Iceberg needs these to build its own column index filtering. Since Iceberg is going to calculate RowRanges itself, this also adds a public method in ParquetFileReader that allows users to pass in RowRanges to read filtered row group. Use of these changes can refer to this PR, currently it uses reflection as a workaround.

@zhongyujiang
Copy link
Contributor Author

@wgtmac @rdblue Can you please help review this?

@wgtmac
Copy link
Member

wgtmac commented Mar 1, 2023

@gszadovszky @shangxinli Do you have any concern?

@gszadovszky
Copy link
Contributor

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");
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense.

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

@rdblue rdblue left a 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.

@rdblue rdblue merged commit cc145b3 into apache:master Mar 7, 2023
@rdblue
Copy link
Contributor

rdblue commented Mar 7, 2023

Thanks, @zhongyujiang!

@zhongyujiang zhongyujiang deleted the public_api_for_page_skipping branch March 23, 2023 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants