Skip to content

Adds a new CoderTranslator for Java SchemaCoders. - #39594

Merged
scwhittle merged 12 commits into
apache:masterfrom
acrites:schema-redo
Aug 25, 2026
Merged

Adds a new CoderTranslator for Java SchemaCoders.#39594
scwhittle merged 12 commits into
apache:masterfrom
acrites:schema-redo

Conversation

@acrites

@acrites acrites commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

The new translator splits out the Schema proto from the toRowFn and fromRowFn's so that runners can check the Schema proto for compatibility updates such as reordering fields. Previously, the coder was simply translated as a custom java coder, which runners couldn't reason about.

Since this is a potentially backwards incompatible change, this new coder format is guarded by the UpdateCompatibilityVersion StreamingOption being 2.76 (or earlier).

This fixes a few issues related to Schemas and pipeline updates: addresses #36496, #30276, #29245.

This PR is essentially a roll forward of the rollback #38514 with the breaking behavior in python fixed. I ran :runners:portability:java:ulrLoopbackValidatesRunner locally with these changes and the tests now all pass.


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.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@acrites

acrites commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@kennknowles and @scwhittle

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
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

@acrites

acrites commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

assign set of reviewers

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @ahmedabu98 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).

@Override
public boolean isKnownCoder(Coder<?> coder, PipelineOptions options) {
if (coder.getClass() == SchemaCoder.class
&& !ExperimentalOptions.hasExperiment(options, "use_known_schema_coder")) {

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.

Since we have pipeline options now, we can check runner capability to translate to use SchemaCoder only when runner supported it. Then we don't need to worry about breaking changes on different runners for now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think we want to start translating to a different portable pipeline for different runners, though... seems like the issue in #33859 (comment) should just be fixed.

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.

I've found that if I add Schemas to the list of coders to be ignored here it causes the previously failing post-commit (beam_PostCommit_Java_ValidatesRunner_ULR) to pass. This makes it so that Python treats the new schema urn as unknown and just passes it along as bytes.

With that change, should I go back to the previous implementation where we use the new schema coder type unless specifying compatibility 2.76 or earlier? i.e. start using this new coder type with 2.77 and later.

@github-actions

Copy link
Copy Markdown
Contributor

Reminder, please take a look at this pr: @ahmedabu98

@github-actions

Copy link
Copy Markdown
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @chamikaramj 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)

@github-actions github-actions Bot added python and removed python labels Aug 21, 2026
@github-actions github-actions Bot added python and removed python labels Aug 21, 2026
@github-actions github-actions Bot added python and removed python labels Aug 21, 2026
@acrites

acrites commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

I believe I've fixed the Python runner issues that previously caused this PR to get rolled back. I ran :runners:portability:java:ulrLoopbackValidatesRunner locally and it now passes.

@Abacn

Abacn commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Thanks, this LGTM as

  • the previous version of the PR was approved

  • Internal import (958568454) shows presubmit tests (on local Dataflow runner) previously failing now passing

@github-actions github-actions Bot added python and removed python labels Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.17%. Comparing base (a26ecfd) to head (d18c7b8).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #39594      +/-   ##
============================================
+ Coverage     57.09%   57.17%   +0.07%     
  Complexity     3639     3639              
============================================
  Files          1191     1194       +3     
  Lines        192556   193273     +717     
  Branches       3816     3814       -2     
============================================
+ Hits         109946   110495     +549     
- Misses        79042    79212     +170     
+ Partials       3568     3566       -2     
Flag Coverage Δ
python 79.82% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@scwhittle

Copy link
Copy Markdown
Contributor

@acrites One of the test failures appears related:

org.junit.ComparisonFailure: expected:<beam:coder[s:javasdk:0.]1> but was:<beam:coder[:schema:v]1>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at org.apache.beam.runners.dataflow.DataflowPipelineTranslatorTest.testSchemaCoderTranslation(DataflowPipelineTranslatorTest.java:1911)

…ompatibilityVersion instead of experiment for new schema coder encoding.
@github-actions github-actions Bot added python and removed python labels Aug 24, 2026
@scwhittle
scwhittle merged commit 66ecc31 into apache:master Aug 25, 2026
122 checks passed
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.

4 participants