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
[BEAM-8575] Added two unit tests in CombineTest class to test AccumulatingCombine #10173
[BEAM-8575] Added two unit tests in CombineTest class to test AccumulatingCombine #10173
Conversation
Although the names of the tests contain "accumulating", those tests are not related to ACCUMULATING or DISCARDING mode. They are testing simple combine cases. Since the Java tests have these names, Python tests follow them. Note that the "simple combine cases" I mentioned above has no special meaning. It is different from the "SimpleCombine" in Java tests, which has a special meaning. |
R: @robertwb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Despite the Java name, accumulating_combine is really poor naming and I don't think we should propagate it.
global_mean = (input | ||
| beam.Values() | ||
| beam.CombineGlobally(combine.MeanCombineFn()) | ||
| beam.ParDo(FormatNaNDoFn())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about just doing beam.Map(str)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Done.
@@ -393,6 +395,54 @@ def test_global_fanout(self): | |||
| beam.CombineGlobally(combine.MeanCombineFn()).with_fanout(11)) | |||
assert_that(result, equal_to([49.5])) | |||
|
|||
@attr('ValidatesRunner') | |||
def test_accumulating_combine(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems mostly redundant with https://github.com/apache/beam/blob/master/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py#L562 , other than the fact that it does globally as well. (Globally is just built on top of per-key, so there's little value in making it validates runner.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed @attr('ValidatesRunner').
Done.
In the Java parity file, quite a few tests are very similar. Some of them are called "SimpleCombine", and some of them are called "BasicCombine", and some are called "AccumulatingCombine". Their only difference is the CombineFn they use. The Java parity: So here in Python I renamed the tests according to the CombineFn they use: |
Reviewer's feedback is addressed. Waiting for reviewer to resolve conversations. |
Run Python PreCommit |
Run Python PreCommit |
…combine cases.
Added two unit tests in CombineTest class to test AccumulatingCombine cases.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).[BEAM-XXX] Fixes bug in ApproximateQuantiles
, where you replaceBEAM-XXX
with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.See the Contributor Guide for more tips on how to make review process smoother.
Post-Commit Tests Status (on master branch)
Pre-Commit Tests Status (on master branch)
See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.