Skip to content

[Java][BigQueryIO] Honor allowMissingRequiredFields when building Storage Write API messages - #40204

Merged
ahmedabu98 merged 1 commit into
apache:masterfrom
khaledh:perf/honor-allow-missing-required-fields-at-build
Oct 22, 2026
Merged

ahmedabu98 merged 1 commit into
apache:masterfrom
khaledh:perf/honor-allow-missing-required-fields-at-build

Conversation

@khaledh

@khaledh khaledh commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

fixes #40189

When allowMissingRequiredFields is true, conversion already skips the missing-required check, but both build sites still call build(), which re-validates the whole tree and can throw. This makes the flag consistent at build time:

return allowMissingRequiredFields ? builder.buildPartial() : builder.build();
  • false path unchanged; a nested test pins the exact SchemaMissingRequiredFieldException diagnostic.
  • In-tree callers passing true already use all-optional descriptors: identical output, one redundant isInitialized() walk removed.
  • Behavior change, declared in CHANGES.md: an external caller passing true with a strict descriptor now gets a partial message instead of UninitializedMessageException. A one-time descriptor check can be added if preferred.
  • Dataflow, production workload: −12% CPU/record alone; −34% CPU and +46% throughput combined with [Feature Request]: Avoid per-field Descriptor.findFieldByName lookups in BigQuery Storage Write API TableRow conversion #40188.

Tests: on/off parity for all-optional descriptors including unknown fields, strict-path failure unchanged, nested diagnostic chain, partial messages for map and positional rows. GCP IO suite green on JDK 11 and 17.

Related: #40188 (independent; either order).


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.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @kennknowles for label java.

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

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

@kennknowles

Copy link
Copy Markdown
Member

R: @ahmedabu98

Sorry to send so many to you, but am I right that you are the current expert in the storage write API paths?

@github-actions

Copy link
Copy Markdown
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment assign set of reviewers

@ahmedabu98 ahmedabu98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! thanks for fixing this

Comment thread CHANGES.md Outdated

## Breaking Changes

* (Java) BigQuery Storage Write API `TableRow` conversion now honors `allowMissingRequiredFields` during protocol-buffer construction. Callers that pass `true` with required descriptors receive partial messages instead of conversion-time `UninitializedMessageException` failures ([#40189](https://github.com/apache/beam/issues/40189)).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't really a breaking change right? Can you add it under ## Bugfixes ?

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.

Moved under Bugfixes.

@khaledh
khaledh force-pushed the perf/honor-allow-missing-required-fields-at-build branch from 6860cb1 to bc220e9 Compare October 21, 2026 17:09
@ahmedabu98
ahmedabu98 merged commit e4c2f8c into apache:master Oct 22, 2026
2 checks passed
@ahmedabu98

Copy link
Copy Markdown
Contributor

Thanks @khaledh!

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]: Honor allowMissingRequiredFields when building Storage Write API messages from TableRow

3 participants