test(workflow-operator): add ReservoirSamplingOpExec spec [release/v1.2 backport]#5642
Merged
Yicong-Huang merged 1 commit intoJun 12, 2026
Conversation
### What changes were proposed in this PR? - Add `ReservoirSamplingOpExecSpec`, the first dedicated spec for the streaming reservoir-sampling executor. - Cover `processTuple` buffering (emits nothing per tuple), and `onFinish` returning all input tuples in order when input size equals k. - Cover keeping exactly k unique, input-drawn samples when input exceeds k, determinism of the seeded RNG (with a check that replacement actually happens), multi-worker partitioning of k via `equallyPartitionGoal` (k=10 across 3 workers yields 4,3,3), and `open` resetting state for executor reuse. - Characterize the input-size-below-k edge case, where the unfilled fixed-size reservoir emits null padding on finish (flagged in the spec as a likely bug for a follow-up fix). ### Any related issues, documentation, or discussions? Closes: apache#5383 ### How was this PR tested? - Run `sbt "WorkflowOperator/testOnly *ReservoirSamplingOpExecSpec"` and expect all 7 examples to pass. - This is a test-only PR (no production code changed), so the spec itself is the verification; the input-below-k example intentionally asserts the current null-padding behavior, so a green run confirms that characterization rather than a fix. ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF (cherry picked from commit 38f5ac5)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.2 #5642 +/- ##
==================================================
+ Coverage 51.86% 51.92% +0.05%
- Complexity 2458 2470 +12
==================================================
Files 1065 1065
Lines 41238 41238
Branches 4417 4417
==================================================
+ Hits 21389 21413 +24
+ Misses 18589 18566 -23
+ Partials 1260 1259 -1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Requested review from the previous reviewer. Thanks! @aglinxinyuan @Yicong-Huang |
Yicong-Huang
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Backport of #5384 to
release/v1.2: addsReservoirSamplingOpExecSpec.scala,the unit test spec for the reservoir sampling operator. Clean
git cherry-pick -xof the original squash commit (38f5ac5fb), purelyadditive, byte-identical to
main.#5606 modifies this spec file, so it must exist on
release/v1.2for the#5606 auto-backport to apply.
Any related issues, documentation, discussions?
How was this PR tested?
Covered by CI; the spec already passed on
main.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Fable 5)