Fixes metadata propagation from doFn output to next parDo by introducing new interface and plumbing propagation#37851
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where metadata associated with Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
|
||
| public abstract <T> void outputWindowedValue(TupleTag<T> tag, WindowedValue<T> windowedValue); | ||
|
|
||
| public abstract void outputWindowedValue(WindowedValue<OutputT> windowedValue); |
There was a problem hiding this comment.
@kennknowles I'm really curious if we are able to avoid that. You've spent quite a lot of time on outputbuilder work to avoid changing public interface and this method is exposed in ProcessContext so any user can use it if they want.
296350a to
90306f3
Compare
- add tests to cover metadata propagation across parDos in single and mulitple stages for direct runner - plumbs metadata propagation, where it was lost previously. spotless
90306f3 to
7beaf1e
Compare
|
few tests to fix as it looks like this approached skipped some timestamp validation. |
cb1c99c to
fee5855
Compare
|
/gemini review |
|
Run Java_PVR_Prism_Loopback PreCommit |
There was a problem hiding this comment.
Code Review
This pull request introduces a new outputWindowedValue(WindowedValue) interface to better propagate metadata, replacing the older interface that took exploded parameters. The changes are well-implemented and plumbed through various runners and components. The new tests for metadata propagation are a great addition.
I've found a few areas for improvement:
- There are a couple of instances of code duplication in new methods that could be refactored for better maintainability.
- I noticed a potential correctness issue in
SimpleDoFnRunnerwhere a timestamp check is missing in newly added methods. - The new test class
MetadataPropagationTesthas a test isolation issue due to a shared static flag, which could lead to flaky tests.
Overall, this is a solid contribution that improves the SDK's metadata handling capabilities. Addressing the points above will make it even better.
runners/core-java/src/main/java/org/apache/beam/runners/core/SimpleDoFnRunner.java
Show resolved
Hide resolved
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/MetadataPropagationTest.java
Show resolved
Hide resolved
...n/java/org/apache/beam/runners/core/OutputAndTimeBoundedSplittableProcessElementInvoker.java
Outdated
Show resolved
Hide resolved
sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnTester.java
Outdated
Show resolved
Hide resolved
fee5855 to
55439e2
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new outputWindowedValue(WindowedValue) interface to simplify metadata propagation, deprecating the older interface that required deconstructing the WindowedValue. The changes are plumbed through various DoFn runners and contexts, and new tests are added to verify the propagation of CausedByDrain metadata. The changes are well-implemented and consistent. I have a couple of minor suggestions for the new test file to improve maintainability.
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/MetadataPropagationTest.java
Show resolved
Hide resolved
sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/MetadataPropagationTest.java
Outdated
Show resolved
Hide resolved
…tadataPropagationTest.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Run Java PreCommit |
|
Run Java_PVR_Prism_Loopback PreCommit |
1 similar comment
|
Run Java_PVR_Prism_Loopback PreCommit |
When data is outputted with processContext, outputReceiver or builder, it's going through sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/DoFnOutputReceivers.java which was still using context.outputWindowedValue(element, ts, windows, pane ...) interface which we decided to abandon as adding new metadata requires changing this interface and we should use builder and windowedValue interface.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
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, commentfixes #<ISSUE NUMBER>instead.CHANGES.mdwith noteworthy changes.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)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.