Skip to content

GH-3697: Reuse hadoop file status and footer in ParquetRecordReader - #3698

Open
steveloughran wants to merge 3 commits into
apache:masterfrom
steveloughran:GH-2415-reuse-footer
Open

GH-3697: Reuse hadoop file status and footer in ParquetRecordReader#3698
steveloughran wants to merge 3 commits into
apache:masterfrom
steveloughran:GH-2415-reuse-footer

Conversation

@steveloughran

Copy link
Copy Markdown
Contributor

Contains contributions by Claude.ai (rebasing; junit5/assertj migration)

Contributed by @wankunde; made current by claude.

Rationale for this change

HTTP HEAD is expensive, slow and comes out of your quota of a few thousand reads/second

What changes are included in this PR?

The InputFile used when reading a file footer is cached in the input split, so all splits read in the same process only will use that and any cached FileStatus when opening the file. This saves a HEAD against s3, azure and gcs on every split read within that process.

Are these changes tested?

new test, otherwise all internal.

Are there any user-facing changes?

no

Closes #3697

wankunde and others added 3 commits July 30, 2026 14:27
…ader

- Ignore InputFile field in ShowFooterCommand
- Create ParquetFileReader with InputFile instead of HadoopInputFile

Was PARQUET-2415

Contains contributions by Claude.ai (rebasing; junit5/assertj migration)

Contributed by wankunde
verify that the metadata isn't included in json or
writable marshalling.
@wankunde

Copy link
Copy Markdown

AFAK, this changed has been ported into several cloud products.
@wgtmac @amousavigourabi @gszadovszky
Could you take a look at this PR ?

@wgtmac wgtmac left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These review comments are generated by Codex. I've just checked them and all of these seem non-blocking to me. Let me know what you think @steveloughran @wankunde.

* @param footer footer of the file this split refers to
*/
public void setFooter(ParquetMetadata footer) {
this.footer = footer;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

footer is omitted from write(), but readFields() never clears it. Hadoop may reuse Writable instances, so a split can retain the footer from another file and ParquetRecordReader may open the wrong InputFile. Please clear footer in readFields() and cover object reuse in the round-trip test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good one. Needs fix.

: HadoopInputFile.fromPath(path, configuration);
ParquetReadOptions options = optionsBuilder.build();
ParquetFileReader reader = footer != null
? ParquetFileReader.open(inputFile, footer, options, inputFile.newStream())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Readers opened from the same encrypted footer share its mutable InternalFileDecryptor and JCE Cipher state, so concurrent splits in one JVM can race. Please use reader-local decryption state or skip footer reuse for encrypted files, and add a concurrent encrypted test.

* Footer of the file, if the split was built by a caller which had already read it.
* Not written by {@link #write(DataOutput)}, so it is only visible within the JVM which set it.
*/
@JsonIgnore

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This JsonIgnore is relocated in the published jar and is invisible to an external ObjectMapper, as the new CLI mix-in notes. The current test runs before shading. Please use a serialization-neutral exclusion and test the shaded artifact; ParquetMetadata.inputFile has the same issue.

@steveloughran

Copy link
Copy Markdown
Contributor Author

I will try to fix but can't set a timeline. If you haven't heard I left cloudera on Friday, I do want to wrap up the recent PRs but I need to set up my mac mini as a dev box first, with the pi5 rebuilt as the docker server. That's where the hadoop 3.4.3 jars on maven central came from, FWIW

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.

Reuse hadoop file status and footer in ParquetRecordReader

3 participants