-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-38854][PYTHON][TEST] Improve the test coverage for pyspark/statcounter.py #36145
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
[SPARK-38854][PYTHON][TEST] Improve the test coverage for pyspark/statcounter.py #36145
Conversation
6366c69 to
f45bcb3
Compare
Increasing code coverage for statcounter Added comments
f45bcb3 to
e1dd3e0
Compare
|
@HyukjinKwon My build is failing with "workflow run detection failed ". Can u please help me on the same |
|
Hm, not sure why it fails to detect. Seems your build is found here: https://github.com/pralabhkumar/spark/actions/runs/2150175269 |
| self.assertEqual(stats.sum(), 20.0) | ||
| self.assertAlmostEqual(stats.variance(), 1.25) | ||
| self.assertAlmostEqual(stats.sampleVariance(), 1.4285714285714286) | ||
| for idx in range(2): |
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.
Can we create a list with:
stats1 = StatCounter([1.0, 2.0])
stats2 = StatCounter(range(1, 301))
stats = stats1.mergeStats(stats2) if idx == 1 else stats2.mergeStats(stats1)
and iterator with this for? Then I think we don't need to introduce this idx.
| # SPARK-38854: Test case to improve test coverage when | ||
| # StatCounter argument is empty list or None | ||
| arguments = [[], None] | ||
| import math |
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.
last nit. you can import this on the top of this file.
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.
@HyukjinKwon Done the changes as suggested
|
Merged to master. |
What changes were proposed in this pull request?
This PR adds a test for the case to check merge_stats when
Why are the changes needed?
To cover corner test cases and increase coverage
Does this PR introduce any user-facing change?
No - test only
How was this patch tested?
CI in this PR should test it out