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

Force portable TestStream to use the Nested Coder context throughout. #33334

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lostluck
Copy link
Contributor

@lostluck lostluck commented Dec 9, 2024

Coder Contexts are largely deprecated as a notion in Beam, and aren't used, with the default being the "nested" coder context instead of the Outer context. There are a few places though that still set "outer coder context" by default, notably in the CoderUtils helper methods.

Where this manifests for TestStream is that CoderUtils is used to take elements and convert them into byte buffers when moved portably. While most coders now ignore the difference, for various legacy reasons, the KVCoder still pipes the context to the value coder, and some coders still understand and use the difference. In this case, the StringUTF8 coder, when given the Outer context, doesn't length prefix the string.

This leads to TestStream values being encoded in weird ways, that don't translate portably. eg. If the values are KV<String, String> the Key will be length prefixed, but the value will not be. This will ultimately cause a break at test run time, because the CoderUtils path isn't used in decoding over Beam Portability, but the normal decoder path, which wouldn't provide the Outer context.

This is likely what's caused difficulty in using TestStream in non-Java SDKs, such as Go on Flink.


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

github-actions bot commented Dec 9, 2024

Test Results

15 tests  +14    4 ✅ + 3   26m 3s ⏱️ + 11m 34s
12 suites +11    0 💤 ± 0 
12 files   +11   11 ❌ +11 

For more details on these failures, see this check.

Results for commit f5dc00b. ± Comparison against base commit 2344fdc.

This pull request removes 1 and adds 15 tests. Note that renamed tests count towards both.
apache_beam.examples.streaming_wordcount_it_test.StreamingWordCountIT ‑ test_streaming_wordcount_it
org.apache.beam.examples.complete.AutoCompleteIT ‑ testE2EAutoComplete
org.apache.beam.examples.complete.TfIdfIT ‑ testE2ETfIdf
org.apache.beam.examples.complete.TopWikipediaSessionsIT ‑ testE2ETopWikiPages
org.apache.beam.examples.complete.TrafficMaxLaneFlowIT ‑ testE2ETrafficMaxLaneFlow
org.apache.beam.examples.complete.TrafficRoutesIT ‑ testE2ETrafficRoutes
org.apache.beam.examples.cookbook.BigQueryTornadoesIT ‑ testE2EBigQueryTornadoesWithExport
org.apache.beam.examples.cookbook.BigQueryTornadoesIT ‑ testE2EBigQueryTornadoesWithExportUsingQuery
org.apache.beam.examples.cookbook.BigQueryTornadoesIT ‑ testE2eBigQueryTornadoesWithStorageApi
org.apache.beam.examples.cookbook.BigQueryTornadoesIT ‑ testE2eBigQueryTornadoesWithStorageApiUsingQuery
org.apache.beam.examples.cookbook.CombinePerKeyExamplesIT ‑ testE2ECombinePerKey
…

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@lostluck lostluck force-pushed the targettedTestStreamCoder branch from f5dc00b to f2b88e9 Compare December 9, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant