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

Core: Add length arg to FileIO.newInputFile #5207

Merged
merged 3 commits into from
Jul 6, 2022

Conversation

rdblue
Copy link
Contributor

@rdblue rdblue commented Jul 5, 2022

While investigating #5206, I found that a lot of time is spent in InputFile#getLength() for manifest files during job planning. This isn't necessary because ManifestFile stored in a manifest list has the manifest file length. This PR avoids round-trip calls to get object lengths by passing the length into FileIO.newInputFile. This implements the improvement for S3, GCP, and Hadoop.

@@ -67,6 +67,6 @@ public PositionOutputStream createOrOverwrite() {

@Override
public InputFile toInputFile() {
return new GCSInputFile(storage(), blobId(), gcpProperties(), metrics());
return new GCSInputFile(storage(), blobId(), null, gcpProperties(), metrics());
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we just use GCSInputFile.fromLocation(...) to avoid calling the constructor with 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.

I just didn't want to change very much here. We probably could.

@@ -70,7 +70,7 @@ public PositionOutputStream createOrOverwrite() {

@Override
public InputFile toInputFile() {
return new S3InputFile(client(), uri(), awsProperties(), metrics());
return new S3InputFile(client(), uri(), null, awsProperties(), metrics());
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to GCS, could we just call S3InputFile.fromLocation(...) to avoid calling the constructor with null?

Copy link
Contributor

@danielcweeks danielcweeks left a comment

Choose a reason for hiding this comment

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

+1 Minor comment/suggestion. Looks good either way.

@rdblue rdblue merged commit 5c85b2f into apache:master Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants