nwangtw commented on a change in pull request #3109: Add withStream() in
Streamlet to support stream selection
URL: https://github.com/apache/incubator-heron/pull/3109#discussion_r233965438
##########
File path: heron/api/src/java/org/apache/heron/streamlet/Streamlet.java
##########
@@ -71,6 +71,22 @@
*/
int getNumPartitions();
+ /**
+ * Set the id of the stream to be used by the children nodes.
+ * Usage (assuming source is a Streamlet object with two output streams:
stream1 and stream2):
+ * source.withStream("stream1").filter(...).log();
+ * source.withStream("stream2").filter(...).log();
+ * @param streamId The specified stream id
+ * @return Returns back the Streamlet with changed stream id
+ */
+ Streamlet<R> withStream(String streamId);
+
+ /**
+ * Gets the stream id of this Streamlet.
+ * @return the stream id of this Streamlet
+ */
+ String getStreamId();
Review comment:
Did a quick search, I think it is pretty close to the split operator in
Flink
(https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/stream/operators/).
In fact, select() seems to be a better name than "withStream". :D I will
think about it.
Neng gives a feedback about the withStream() function as a new user and he
made a good point that we need to handle both cases:
1.
stream.map();
stream.withStream("a").map();
stream.map(); // this should be the default stream
stream.withStream("a").map();
2.
steam2 = stream.withString("a");
stream2.map(); // this should be the new stream
stream.map(); // this should be the default stream
And this is not supported with the current implementation since the this
object is muted. I am going to see what is the best way and update this PR.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services