Skip to content

Update Beam Protobuf Schema (Java) - #35150

Merged
kennknowles merged 13 commits into
apache:masterfrom
baeminbo:fix-35081
Sep 25, 2025
Merged

Update Beam Protobuf Schema (Java)#35150
kennknowles merged 13 commits into
apache:masterfrom
baeminbo:fix-35081

Conversation

@baeminbo

@baeminbo baeminbo commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Fix #35081.

Refer to https://s.apache.org/beam-protobuf.


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.

@baeminbo
baeminbo force-pushed the fix-35081 branch 4 times, most recently from 9342333 to 23875da Compare June 5, 2025 06:58
@baeminbo baeminbo changed the title [WIP] Update Beam Protobuf Schema (Java) Update Beam Protobuf Schema (Java) Jun 5, 2025
@github-actions

github-actions Bot commented Jun 5, 2025

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

@baeminbo
baeminbo force-pushed the fix-35081 branch 4 times, most recently from 6ae0d10 to 5e53125 Compare June 6, 2025 02:16
@liferoad

Copy link
Copy Markdown
Contributor

@ahmedabu98

@kennknowles

Copy link
Copy Markdown
Member

I think that the many cases of @NonNull and @Nullable applied to type variables indicates a problem. Each one really needs a comment justifying it, because it is unusual and actually a somewhat inflexible situation. Probably you can remove most of them. And some places where you have a type variable and you need to constrain what types it can be instantiated with, you would use extends @NonNull Object (the default if you do not annotate is extends @Nullable Object which allows the type variable to be instantiated with any type)

@baeminbo

Copy link
Copy Markdown
Contributor Author

I've removed @NonNull and @Nullable from generic types in the ProtoBeamConverter class.

I realized I had significantly misunderstood their proper usage. Nullability annotations on generics are only for specific use cases with strong reasoning (apparently a container-like class?).

@baeminbo

Copy link
Copy Markdown
Contributor Author

Run Java PreCommit

1 similar comment
@baeminbo

Copy link
Copy Markdown
Contributor Author

Run Java PreCommit

@baeminbo

Copy link
Copy Markdown
Contributor Author

Run Java_Amazon-Web-Services2_IO_Direct PreCommit

@baeminbo

Copy link
Copy Markdown
Contributor Author

@kennknowles could you review this pr again? Thanks

@derrickaw

Copy link
Copy Markdown
Collaborator

Hi @kennknowles, can you review this PR when you get a chance? Thanks!

@jkimshop

jkimshop commented Sep 5, 2025

Copy link
Copy Markdown

Hello @kennknowles , are you able to review this PR when again? Thank you.

@kennknowles kennknowles left a comment

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've got to admit it is hard for me to be certain I've checked enough to catch any potential problem. But I think I've done the best I can at this time. Hopefully we can get this tested via some real-world use cases and confirm it isn't breaking things in a way we can't recover from.

Honestly might want a second pair of eyes, like @reuvenlax

return proto ->
((List<Object>) proto)
.stream()
.map(element -> Preconditions.checkNotNull(elementConverter.convert(element)))

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.

In general, the SDK's checkArgumentNotNull is preferred, because it throws IllegalArgumentException so that it clearly blames the caller, as it should in this case. Using Guava's checkNotNull causes it to the NPE which a user will correctly interpret as equivalent to a segfault in terms of the coding that led to it.

You don't have to fix it in this PR but it is a useful followup to just avoid Guava's checkNotNull entirely. I should make a checkstyle rule...

@kennknowles

Copy link
Copy Markdown
Member

Confirmed that both test failures look like flakes. I'm re-running them.

@stankiewicz

Copy link
Copy Markdown
Contributor

ready to merge @kennknowles ?

@kennknowles
kennknowles merged commit c3ef7f3 into apache:master Sep 25, 2025
26 of 29 checks passed
@yyfhust

yyfhust commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

Thanks for the fix ! Friendly ask : would you do a patch release of beam that includes this fix ?

@liferoad

Copy link
Copy Markdown
Contributor

Thanks for the fix ! Friendly ask : would you do a patch release of beam that includes this fix ?

We usually do not do a patch release. If you need this now, you can use the SNAPSHOT version: https://github.com/apache/beam/blob/master/contributor-docs/code-change-guide.md#run-your-pipeline-with-modified-beam-code

@Abacn

Abacn commented Sep 25, 2025

Copy link
Copy Markdown
Contributor

Abacn added a commit that referenced this pull request Sep 25, 2025
@baeminbo

Copy link
Copy Markdown
Contributor Author

@Abacn it still failed after the revert: https://github.com/apache/beam/actions/runs/18023411365. I doubt if this change really caused the test failing.

@Abacn

Abacn commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

https://github.com/apache/beam/actions/runs/18023411365

This run was against HEAD. The revert hasn't merged into HEAD (master branch) yet (open PR: #36288). The link is a manually triggered run on HEAD+revert this PR

baeminbo added a commit to baeminbo/beam that referenced this pull request Sep 26, 2025
@baeminbo

Copy link
Copy Markdown
Contributor Author

@Abacn, thanks, a bug was found with OneOfType that is also found in the failed run: https://github.com/apache/beam/actions/runs/18028890287/job/51301187348 (the error stacktrace is at [1]).

I created #36297 to fix it, but I cannot run the test on the PR. Could you let me know how I can run the test?

[1]

NFO     ExpansionService:subprocess_server.py:232 Exception in thread "main" java.util.ServiceConfigurationError: org.apache.beam.sdk.schemas.transforms.SchemaTransformProvider: Provider org.apache.beam.sdk.extensions.sql.expansion.SqlTransformSchemaTransformProvider could not be instantiated
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:582)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:804)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:722)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1395)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.expansion.service.ExpansionServiceSchemaTransformProvider.<init>(ExpansionServiceSchemaTransformProvider.java:53)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.expansion.service.ExpansionServiceSchemaTransformProvider.of(ExpansionServiceSchemaTransformProvider.java:69)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.expansion.service.ExpansionService.getRegisteredSchemaTransforms(ExpansionService.java:565)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.expansion.service.ExpansionService.main(ExpansionService.java:844)
INFO     ExpansionService:subprocess_server.py:232 Caused by: java.lang.ExceptionInInitializerError
INFO     ExpansionService:subprocess_server.py:232 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
INFO     ExpansionService:subprocess_server.py:232 	at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:780)
INFO     ExpansionService:subprocess_server.py:232 	... 6 more
INFO     ExpansionService:subprocess_server.py:232 Caused by: java.lang.IllegalArgumentException: OneOf fields do not support nullable subfields.
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Preconditions.checkArgument(Preconditions.java:143)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.schemas.logicaltypes.OneOfType.create(OneOfType.java:78)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.schemas.logicaltypes.OneOfType.create(OneOfType.java:72)
INFO     ExpansionService:subprocess_server.py:232 	at org.apache.beam.sdk.extensions.sql.expansion.SqlTransformSchemaTransformProvider.<clinit>(SqlTransformSchemaTransformProvider.java:58)
INFO     ExpansionService:subprocess_server.py:232 	... 11 more

@baeminbo
baeminbo deleted the fix-35081 branch March 9, 2026 07:12
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]: Beam Protobuf Schema (Java)

9 participants