Repository navigation
chore: fix limit and limitWeighted Scaladoc - #3591
Merged
Merged
Conversation
Motivation: The Scaladoc of limit and limitWeighted does not match the code: - the javadsl Flow, Source, SubFlow and SubSource versions were copied from take: they say the stream completes when "the defined number of elements has been taken" and completes without producing elements when n is zero or negative, but these operators fail the stream with StreamLimitReachedException once the limit is exceeded - the scaladsl limitWeighted "Completes when" line talks about the number of emitted elements rather than the accumulated cost - all of them name the exception StreamLimitException, which does not exist; LimitWeighted fails with StreamLimitReachedException Modification: Describe the actual behaviour in the Emits/Completes/Errors/Cancels lines of limit and limitWeighted in scaladsl Flow and javadsl Flow, Source, SubFlow and SubSource, drop the copied zero-or-negative sentence, add the missing Errors lines and name StreamLimitReachedException. Result: The Scaladoc matches the LimitWeighted stage (limit is limitWeighted with a cost of 1 per element). Tests: - Not run - Scaladoc only References: Refs apache#3590
He-Pin
reviewed
Oct 9, 2026
He-Pin
left a comment
Member
There was a problem hiding this comment.
The StreamLimitReachedException fix and the removal of the zero/negative sentence are both correct against Ops.scala and StreamLimitReachedException.scala, and DSL parity looks complete. One thing still open before I merge: the published operator docs still carry the exact defect you are fixing here.
He-Pin
force-pushed
the
scaladoc-limitweighted
branch
from
October 9, 2026 05:38
e7fcca2 to
816baa9
Compare
He-Pin
approved these changes
Oct 9, 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.
Motivation
The Scaladoc of limit and limitWeighted does not match the code:
from take: they say the stream completes when "the defined number of
elements has been taken" and completes without producing elements
when n is zero or negative, but these operators fail the stream with
StreamLimitReachedException once the limit is exceeded
number of emitted elements rather than the accumulated cost
exist; LimitWeighted fails with StreamLimitReachedException
Modification
Describe the actual behaviour in the Emits/Completes/Errors/Cancels
lines of limit and limitWeighted in scaladsl Flow and javadsl Flow,
Source, SubFlow and SubSource, drop the copied zero-or-negative
sentence, add the missing Errors lines and name
StreamLimitReachedException.
Result
The Scaladoc matches the LimitWeighted stage (limit is limitWeighted
with a cost of 1 per element).
Tests
References
Refs #3590