Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/16989#discussion_r117169752
--- Diff:
common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java
---
@@ -95,6 +97,25 @@ public ManagedBuffer getChunk(long streamId, int
chunkIndex) {
}
@Override
+ public ManagedBuffer openStream(String streamChunkId) {
+ Tuple2<Long, Integer> streamIdAndChunkId =
parseStreamChunkId(streamChunkId);
+ return getChunk(streamIdAndChunkId._1, streamIdAndChunkId._2);
+ }
+
+ public static String genStreamChunkId(long streamId, int chunkId) {
+ return String.format("%d_%d", streamId, chunkId);
+ }
+
+ public static Tuple2<Long, Integer> parseStreamChunkId(String
streamChunkId) {
--- End diff --
This method is called in a single place. Because it needs to return two
values I see that you had to import the Scala tuple class in this Java code.
You could avoid the need to do this by simply inlining this at its sole call
site, which I think would make the code simpler to read.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]