Skip to content

Conversation

@pralabhkumar
Copy link
Contributor

What changes were proposed in this pull request?

This PR adds a test for the case to check merge_stats when

  • One StatCounter size largely greater than the other .
  • NA, None is passed to StatCounter

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

@pralabhkumar pralabhkumar force-pushed the rk_increase_coverage_statcounter branch from 6366c69 to f45bcb3 Compare April 11, 2022 14:33
Increasing code coverage for statcounter

Added comments
@pralabhkumar pralabhkumar force-pushed the rk_increase_coverage_statcounter branch from f45bcb3 to e1dd3e0 Compare April 11, 2022 14:42
@pralabhkumar
Copy link
Contributor Author

@HyukjinKwon My build is failing with "workflow run detection failed ". Can u please help me on the same

@HyukjinKwon
Copy link
Member

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

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
Copy link
Member

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.

Copy link
Contributor Author

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

@pralabhkumar
Copy link
Contributor Author

@HyukjinKwon
Copy link
Member

Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants