Github user zsxwing commented on a diff in the pull request:
https://github.com/apache/spark/pull/18388#discussion_r128879607
--- Diff:
common/network-common/src/main/java/org/apache/spark/network/server/OneForOneStreamManager.java
---
@@ -96,18 +103,23 @@ public ManagedBuffer getChunk(long streamId, int
chunkIndex) {
@Override
public ManagedBuffer openStream(String streamChunkId) {
- String[] array = streamChunkId.split("_");
- assert array.length == 2:
- "Stream id and chunk index should be specified when open stream for
fetching block.";
- long streamId = Long.valueOf(array[0]);
- int chunkIndex = Integer.valueOf(array[1]);
- return getChunk(streamId, chunkIndex);
+ Pair<Long, Integer> streamChunkIdPair =
parseStreamChunkId(streamChunkId);
+ return getChunk(streamChunkIdPair.getLeft(),
streamChunkIdPair.getRight());
}
public static String genStreamChunkId(long streamId, int chunkId) {
return String.format("%d_%d", streamId, chunkId);
}
+ public static Pair<Long, Integer> parseStreamChunkId(String
streamChunkId) {
--- End diff --
nit: please document the meaning of the return value for this public method.
---
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]