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

[BEAM-8575] Added two unit tests in CombineTest class to test AccumulatingCombine #10173

Merged
merged 3 commits into from Dec 16, 2019

Conversation

bumblebee-coming
Copy link
Contributor

@bumblebee-coming bumblebee-coming commented Nov 20, 2019

…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:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Format the pull request title like [BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replace BEAM-XXX with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.
  • 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.

Post-Commit Tests Status (on master branch)

Lang SDK Apex Dataflow Flink Gearpump Samza Spark
Go Build Status --- --- Build Status --- --- Build Status
Java Build Status Build Status Build Status Build Status
Build Status
Build Status
Build Status Build Status Build Status
Build Status
Build Status
Python Build Status
Build Status
Build Status
Build Status
--- Build Status
Build Status
Build Status
Build Status
--- --- Build Status
XLang --- --- --- Build Status --- --- ---

Pre-Commit Tests Status (on master branch)

--- Java Python Go Website
Non-portable Build Status Build Status
Build Status
Build Status Build Status
Portable --- Build Status --- ---

See .test-infra/jenkins/README for trigger phrase, status and link of all Jenkins jobs.

@bumblebee-coming
Copy link
Contributor Author

bumblebee-coming commented Nov 20, 2019

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.

@bumblebee-coming
Copy link
Contributor Author

R: @robertwb

@bumblebee-coming bumblebee-coming changed the title [BEAM-8575] Added two unit tests in CombineTest class to test simple … [BEAM-8575] Added two unit tests in CombineTest class to test Accumulating … Nov 21, 2019
@bumblebee-coming bumblebee-coming changed the title [BEAM-8575] Added two unit tests in CombineTest class to test Accumulating … [BEAM-8575] Added two unit tests in CombineTest class to test AccumulatingCombine Nov 21, 2019
Copy link
Contributor

@robertwb robertwb left a 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()))
Copy link
Contributor

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

Copy link
Contributor Author

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):
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed @attr('ValidatesRunner').
Done.

@bumblebee-coming
Copy link
Contributor Author

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:
https://github.com/apache/beam/blob/master/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java#L1448

So here in Python I renamed the tests according to the CombineFn they use:
test_MeanCombineFn_combine
test_MeanCombineFn_combine_empty

@bumblebee-coming
Copy link
Contributor Author

bumblebee-coming commented Nov 22, 2019

Reviewer's feedback is addressed. Waiting for reviewer to resolve conversations.

@bumblebee-coming
Copy link
Contributor Author

Run Python PreCommit

@robertwb
Copy link
Contributor

robertwb commented Dec 9, 2019

Run Python PreCommit

@robertwb robertwb merged commit b816ae3 into apache:master Dec 16, 2019
dpcollins-google pushed a commit to dpcollins-google/beam that referenced this pull request Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants