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

Use avro DataFileReader to read avro container files #23214

Merged
merged 1 commit into from
Sep 22, 2022

Conversation

steveniemitz
Copy link
Contributor

This fixes #23213

This refactors AvroSource to use the standard DataFileReader from Avro. I don't really have the context around why a custom file parser was written in beam for this, but the code is so old I assume that DataFileReader couldn't properly support reading from arbitrary positions in a container file when it was written.

R: @iemejia (you were the last person other than myself to substantially change this class)


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@github-actions github-actions bot added the java label Sep 13, 2022
@github-actions
Copy link
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@steveniemitz
Copy link
Contributor Author

Run Java_PVR_Flink_Docker PreCommit

@steveniemitz
Copy link
Contributor Author

Run Kotlin_Examples PreCommit

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @lukecwik for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Contributor

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @lukecwik for label java.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@steveniemitz
Copy link
Contributor Author

ping @iemejia

Copy link
Member

@iemejia iemejia left a comment

Choose a reason for hiding this comment

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

LGTM Really nice simplification/reuse. (My excuses for the delay to do the review).

throw new IllegalArgumentException("Unsupported codec: " + codec);
}
}
private final long numRecordsInBlock;
Copy link
Member

Choose a reason for hiding this comment

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

Much better name 👍

// Initialized in startReading.
private @Nullable AvroMetadata metadata;

private static class SeekableChannelInput implements SeekableInput {
Copy link
Member

Choose a reason for hiding this comment

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

A pity this one does not exist in Avro

@@ -717,71 +678,25 @@ public synchronized AvroSource<T> getCurrentSource() {
//
// Postcondition: same as above, but for the new current (formerly next) block.
@Override
public boolean readNextBlock() throws IOException {
long startOfNextBlock;
synchronized (progressLock) {
Copy link
Member

Choose a reason for hiding this comment

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

👍

@iemejia iemejia merged commit 483a0c9 into apache:master Sep 22, 2022
@iemejia iemejia changed the title use avro DataFileReader to read avro container files Use avro DataFileReader to read avro container files Sep 22, 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.

[Feature Request]: AvroSource should use the standard CodecFactory to decompress blocks
2 participants