Skip to content
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

GH-3078: Use Hadoop FileSystem.openFile() to open files #3079

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

steveloughran
Copy link
Contributor

@steveloughran steveloughran commented Nov 26, 2024

Rationale for this change

If parquet passes down the FileStatus it previously collected, S3A and ABFS clients can skip their own HEAD probe. This saves time, money and IO capacity.

When the read policy is passed in, the clients know immediately what kind of read pattern to expect, rather than infer it as reads take place or from the file suffix.

What changes are included in this PR?

  • Open files with FileSystem.openFile(), passing in file status
  • And read policy of "parquet, vector, random, adaptive"

Are these changes tested?

Through parquet-hadoop.

Are there any user-facing changes?

no.

Closes #3078

* Open files with FileSystem.openFile(), passing in file status
* And read policy of "parquet, vector, random, adaptive"
@steveloughran steveloughran marked this pull request as draft November 27, 2024 12:16
@steveloughran steveloughran marked this pull request as ready for review November 27, 2024 22:05
@wgtmac
Copy link
Member

wgtmac commented Nov 28, 2024

@Fokko @gszadovszky Could you help review this? Thanks!

try {
return future.get();
} catch (InterruptedException e) {
throw (InterruptedIOException) new InterruptedIOException(e.toString()).initCause(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Why the cast?

Copy link
Contributor Author

@steveloughran steveloughran Nov 29, 2024

Choose a reason for hiding this comment

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

initCause() returns a throwable; you need to casr it back to what the actual exception is so you can throw it

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, missed that, thanks!

// equal the path in the FileStatus; Hive virtual FS could create this condition.
// As the path to open is derived from stat.getPath(), this condition seems
// near-impossible to create -but is handled here for due diligence.
stream = fs.open(stat.getPath());
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we at least log the original exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. at debug? I'm never a fan of excessively noisy libraries as they ruin the lives of people downstream, especially if messages for developers end up being printed in user logs far too often. In fact, I'm not above dynamically patching log levels to shut those libraries up (HADOOP-19272)...

stack trace then, debug.
error text itself? Probably the same unless there's a desire to log exactly once during the life of a process, which could be done trivially

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with any solutions just did not want to loose the exception may occur.

Another idea I've had is to catch the potential exception may come out of this line (let's call it e2) and add the previously caught e as suppressed to e2, then re-throw. But it might be an overkill since this code path "near-impossible" to be taken.

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.

Use Hadoop FileSystem.openFile() to open files
3 participants