Uh oh!
There was an error while loading. Please reload this page.
GH-3141: Add constructor to ParquetFileReader to allow passing in parquet footer - #3165
GH-3141: Add constructor to ParquetFileReader to allow passing in parquet footer#3165yuzhu wants to merge 6 commits into
Conversation
wgtmac
left a comment
There was a problem hiding this comment.
Thanks! I have left some minor comments.
| try { | ||
| this.footer = readFooter(file, options, f, converter); | ||
| } catch (IOException e) { | ||
| f.close(); |
There was a problem hiding this comment.
| f.close(); | |
| // In case that reading footer throws an exception in the constructor, the new stream | |
| // should be closed. Otherwise, there's no way to close this outside. | |
| f.close(); |
Please keep its original comment
| } | ||
| } | ||
| public ParquetFileReader(InputFile file, ParquetMetadata footer, ParquetReadOptions options, SeekableInputStream f) |
There was a problem hiding this comment.
Could you add a javadoc for this new method?
There was a problem hiding this comment.
Please add the corresponding static open method together
wgtmac
commented
Mar 1, 2025
BTW, could you also add a test case for it? |
pan3793
commented
Apr 30, 2025
@yuzhu do you have time to address the above comments? I ported this change into our internal branches, with some modifications on the Spark, vectorized reading could dramatically reduce 3/4 of the namenode RPC. |
yuzhu
commented
Apr 30, 2025
@pan3793 glad it helped. I will wrap this up this week. |
pan3793
commented
Apr 30, 2025
apache/spark#50765 demonstrates how this PR benefits Spark. |
pan3793
commented
May 12, 2025
Kindly ping @yuzhu |
pan3793
commented
Jun 23, 2025
@yuzhu thanks for updating. I think you need a rebase to resolve conflicts |
| } catch (Exception e) { | ||
| } catch (IOException e) { | ||
| // In case that reading footer throws an exception in the constructor, the new stream | ||
| // should be closed. Otherwise, there's no way to close this outside. |
There was a problem hiding this comment.
| // should be closed. Otherwise, there's no way to close this outside. | |
| // should be closed. Otherwise, there's no way to close this outside. |
| try { | ||
| this.footer = readFooter(file, options, f, converter); | ||
| } catch (Exception e) { | ||
| } catch (IOException e) { |
There was a problem hiding this comment.
it was not intentional. thanks for catching it.
pan3793
commented
Jun 23, 2025
code change lgtm, better to have to test coverage as requested by @wgtmac |
yuzhu
commented
Jun 23, 2025
is there an example unit test to model after? I didnt find any unit test for this ParquetFileReader.java file |
wangyum
commented
Jul 11, 2025
cc @yuzhu |
wgtmac
commented
Jul 14, 2025
Please fix the style issue. @yuzhu |
wangyum
commented
Jul 31, 2025
pan3793
commented
Aug 1, 2025
I'd like to pick it up if the original author does not have time to continue this PR. |

Rationale for this change
HadoopFile is getting deprecated, it is useful to be able to pass in a parsed footer instead of reading the footer every time
What changes are included in this PR?
a new constructor
Are these changes tested?
Yes
Are there any user-facing changes?
No
Some code duplication is there, because we cant call another constructor and catch the IOException to close the stream. Let me know if you would like this handled in another way. Thanks.
Closes#3141