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

fix error in BigQueryUtils when retrieving non existent avro field #30720

Merged
merged 5 commits into from
Apr 1, 2024

Conversation

tilgalas
Copy link
Contributor

@tilgalas tilgalas commented Mar 22, 2024

fixes #30730
fixes #30729

An integration test called BigQueryIOStorageReadIT.testBigQueryStorageReadProjectionPushdown is failing - this is because the pushdown optimizer projects the record retrieved from the bigquery by removing unused string_field. Later the toBeamRow conversion method iterates through the beam schema's fields and tries to extract a value from the avro record for every such field, including the one that has been removed by the optimizer - avro version 1.8 didn't have a problem with attempting to get a value from non-existent field - it simply returned null, but things have changed in version 1.11, and now this operation throws an exception. The fix is to check whether the field exists in the record before attempting to fetch its value. Also - added a unit test specifically for this situation


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

  • 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 or the workflows README to see a list of phrases to trigger workflows.

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

Copy link
Contributor

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

R: @bvolpato for label java.
R: @damccorm for label build.
R: @johnjcasey for label io.

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).

@tilgalas tilgalas changed the title dump the record schema in BigQueryUtils exception message for debuggi… fix error in BigQueryUtils when retrieving non existent avro field Mar 25, 2024
@tilgalas
Copy link
Contributor Author

Run PostCommit_Java_Dataflow

@Abacn
Copy link
Contributor

Abacn commented Apr 1, 2024

V2 PostCommit passed; V1 PostCommit failed quota issue on unrelated tests, merging for now

@Abacn Abacn merged commit d59ef19 into apache:master Apr 1, 2024
19 of 20 checks passed
@tilgalas tilgalas deleted the avro-it-fix branch April 2, 2024 11:32
hjtran pushed a commit to hjtran/beam that referenced this pull request Apr 4, 2024
…pache#30720)

* dump the record schema in BigQueryUtils exception message for debugging purposes

* include the right test

* check if the field exists in the record before fetching it

* add test, restore previous exception message

* trigger V2 PostCommit as well
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.

The PostCommit Java Dataflow V1 job is flaky The PostCommit Java Dataflow V2 job is flaky
2 participants