-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
+str Add combine seq method to Source and Sink #31345
Conversation
3c5c4bb
to
76276a4
Compare
d8db0b4
to
256406e
Compare
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.
Maybe those help with the compilation problem?
4d1709a
to
338d7d1
Compare
6c1c031
to
28d316b
Compare
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.
Starting to look quite useful!
@He-Pin any chance you'll have time to continue this PR any time soon? |
1678713
to
ae1e646
Compare
f0fe84e
to
9b2ead7
Compare
@@ -370,6 +371,29 @@ object Sink { | |||
new Sink(scaladsl.Sink.combine(output1.asScala, output2.asScala, seq: _*)(num => strategy.apply(num))) | |||
} | |||
|
|||
/** |
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.
I have update the PR to address comments, one issue is that the old style will pass out the @patriknw @raboof @johanandren I think this is ready, and maybe need to go with |
32d1294
to
2ae541f
Compare
* Combines several sources with fan-in strategy like [[Merge]] or [[Concat]] into a single [[Source]]. | ||
*/ | ||
def combine[T, U, M](sources: immutable.Seq[Graph[SourceShape[T], M]])( | ||
fanInGraph: Graph[UniformFanInShape[T, U], NotUsed]): Source[U, immutable.Seq[M]] = |
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.
this could still be named something with strategy. fanInStrategy
?
@johanandren note that I suggested this strategy parameter to not be like the other existing combine
strategy: Int => Graph[UniformFanOutShape[T, U], NotUsed]
Do you know why the original API was like that? The Int is just the size of sources. Was it only for convenience to be able to write Merge(_)
?
Should we keep it the same even if it seems weird to me?
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.
I don't remember any rationale but I'd guess the same as you, to be able to do Merge(_)
and Concat(_)
, kinda superfluous because you know the size, but OTOH possible to get wrong if it is not fed to the strategy but repeated by user.
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.
@He-Pin sorry for the extra work, but could you change back to the old strategy: Int =>
so that we have a consistent api for these and what already exists.
strategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]): Sink[T, NotUsed] = { | ||
@nowarn | ||
@deprecatedName(Symbol("strategy")) | ||
fanOutStrategy: function.Function[java.lang.Integer, Graph[UniformFanOutShape[T, U], NotUsed]]) |
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.
changed to the fanOutStrategy
strategy: Int => Graph[UniformFanOutShape[T, U], NotUsed]): Sink[T, NotUsed] = | ||
@nowarn | ||
@deprecatedName(Symbol("strategy")) | ||
fanOutStrategy: Int => Graph[UniformFanOutShape[T, U], NotUsed]): Sink[T, NotUsed] = |
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.
renamed to fanOutStrategy
@patriknw @johanandren I have updated this PR. |
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.
LGTM
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.
LGTM, thanks!
refs: #23958
Partially fixed it, the combineMat up to 22 version may need some discussion