Skip to content

Conversation

@damccorm
Copy link
Contributor

@damccorm damccorm commented Oct 7, 2025

This PR adds some x-lang tests to test that the gbek option works when calling across languages from Java to Python. Most of the fixes in this PR are related to that (+131 lines). As part of this work, though, I also noticed/fixed 2 problems:

  1. Pipeline options weren't being respected across this boundary; to fix this, I added a way to merge pipeline options in pipeline_options.py, and then used that instead of the previous very incomplete merging logic in expansion_service.py. Before, we hadn't been doing anything with these options anyways when calling in from Java because of Fix passing pipeline options to external transforms #36443.
  2. Incorrect coders were being used coming out of GBEK because it wasn't recognizing the output types. I fixed this by explicitly calling with_output_types at the end of the expansion_service.py.

#36457 contains the Python -> Java version of these tests.

Part of #36214


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 github-actions bot added the java label Oct 7, 2025
@damccorm damccorm changed the title [WIP] x-lang gbek tests x-lang GroupByEncryptedKey Oct 8, 2025
@codecov
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 36.21%. Comparing base (c8df4da) to head (5258999).

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #36418       +/-   ##
=============================================
- Coverage     55.02%   36.21%   -18.82%     
  Complexity     1666     1666               
=============================================
  Files          1058     1058               
  Lines        165254   165291       +37     
  Branches       1190     1190               
=============================================
- Hits          90939    59865    -31074     
- Misses        72138   103249    +31111     
  Partials       2177     2177               
Flag Coverage Δ
python 40.54% <ø> (-40.41%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 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.

@github-actions github-actions bot added the build label Oct 9, 2025
@damccorm
Copy link
Contributor Author

damccorm commented Oct 9, 2025

Moved Python -> Java tests to #36457 for clarity since this now has functional changes, not just test changes.

@damccorm damccorm changed the title x-lang GroupByEncryptedKey x-lang GroupByEncryptedKey (Java to Python) Oct 9, 2025
@damccorm
Copy link
Contributor Author

damccorm commented Oct 9, 2025

Now seeing xvr failures with:

java.lang.RuntimeException: org.apache.beam.sdk.coders.CoderException: `UnknownCoderWrapper` was used to perform an actual decoding in the Java SDK. Potentially a Java transform is being followed by a cross-language transform that uses a coder that is not available in the Java SDK. Please make sure that Python transforms at the multi-language boundary use Beam portable coders.
	at org.apache.beam.sdk.util.construction.UnknownCoderWrapper.decode(UnknownCoderWrapper.java:55)
	at org.apache.beam.sdk.coders.Coder.decode(Coder.java:159)
	at org.apache.beam.sdk.coders.LengthPrefixCoder.decode(LengthPrefixCoder.java:64)
	at org.apache.beam.sdk.coders.KvCoder.decode(KvCoder.java:83)
	at org.apache.beam.sdk.coders.KvCoder.decode(KvCoder.java:37)
	at org.apache.beam.sdk.values.WindowedValues$FullWindowedValueCoder.decode(WindowedValues.java:847)
	at org.apache.beam.sdk.values.WindowedValues$FullWindowedValueCoder.decode(WindowedValues.java:838)
	at org.apache.beam.sdk.values.WindowedValues$FullWindowedValueCoder.decode(WindowedValues.java:784)
	at org.apache.beam.sdk.fn.data.BeamFnDataInboundObserver.multiplexElements(BeamFnDataInboundObserver.java:232)
	at org.apache.beam.fn.harness.control.ProcessBundleHandler.processBundle(ProcessBundleHandler.java:527)
	at org.apache.beam.fn.harness.control.BeamFnControlClient.delegateOnInstructionRequestType(BeamFnControlClient.java:150)
	at org.apache.beam.fn.harness.control.BeamFnControlClient$InboundObserver.lambda$onNext$0(BeamFnControlClient.java:115)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.apache.beam.sdk.util.UnboundedScheduledExecutorService$ScheduledFutureTask.run(UnboundedScheduledExecutorService.java:163)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

I'd seen this locally, but had thought I'd moved past it (and did get at least one green run here). Will debug further, it seems like it could be an issue with type inference

@damccorm damccorm marked this pull request as ready for review October 13, 2025 15:24
@damccorm
Copy link
Contributor Author

assign set of reviewers

@github-actions
Copy link
Contributor

Assigning reviewers:

R: @liferoad for label python.
R: @m-trieu for label java.
R: @liferoad for label build.

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

@damccorm
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds cross-language tests for GroupByEncryptedKey (GBEK) from Java to Python, and includes several important fixes for cross-language pipeline option handling and coder inference. The changes in the Python SDK for merging pipeline options and explicitly setting output types are well-implemented. The new Java test for GBEK is a great addition. I've suggested a few improvements to the test code to handle resources more safely and to make the failure test case more robust.

Copy link
Contributor

@chamikaramj chamikaramj left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@damccorm damccorm merged commit 7a9a4e6 into master Oct 14, 2025
134 of 146 checks passed
@damccorm damccorm deleted the users/damccorm/gbek-xlang-tests branch October 14, 2025 21:02
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.

2 participants