You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "sarutak (via GitHub)" <gi...@apache.org> on 2025/09/04 13:07:12 UTC
Re: [PR] [SPARK-53351][CORE] Use consistent string type blockId for block data access in external block handler [spark]
sarutak commented on code in PR #52095:
URL: https://github.com/apache/spark/pull/52095#discussion_r2321834421
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalBlockHandler.java:
##########
@@ -383,26 +384,29 @@ private class ManagedBufferIterator implements Iterator<ManagedBuffer> {
String appId = msg.appId;
String execId = msg.execId;
String[] blockIds = msg.blockIds;
+ size = blockIds.length;
String[] blockId0Parts = blockIds[0].split("_");
- if (blockId0Parts.length == 4 && blockId0Parts[0].equals(SHUFFLE_BLOCK_ID)) {
- final int shuffleId = Integer.parseInt(blockId0Parts[1]);
- final int[] mapIdAndReduceIds = shuffleMapIdAndReduceIds(blockIds, shuffleId);
Review Comment:
Once this code deleted, `shuffleMapIdAndReduceIds` is used nowhere and it's private. Can we delete the definition of `shuffleMapIdAndReduceIds`?
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java:
##########
@@ -207,7 +229,19 @@ public ManagedBuffer getRddBlockData(
throw new RuntimeException(
String.format("Executor is not registered (appId=%s, execId=%s)", appId, execId));
}
- return getDiskPersistedRddBlockData(executor, rddId, splitIndex);
+ return getDiskPersistedRddBlockData(executor, "rdd_" + rddId + "_" + splitIndex);
Review Comment:
Instead of changing this line, how about calling newly overloaded `getRddBlockData` from the original one to minimize duplication.
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/BlockIdUtils.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.network.shuffle;
+
+import org.apache.spark.network.shuffle.checksum.ShuffleChecksumHelper;
+
+public class BlockIdUtils {
Review Comment:
This seems a kind of utility class so is it better to have a private default constructor to avoid accidental instantiation.
I see some similar cases
https://github.com/apache/spark/blob/336ca8c12a163d31519a491a28d26ff091626986/sql/hive-thriftserver/src/main/java/org/apache/hive/service/auth/HttpAuthUtils.java#L147-L149
https://github.com/apache/spark/blob/336ca8c12a163d31519a491a28d26ff091626986/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeDataUtils.java#L26-L28
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java:
##########
@@ -346,10 +380,10 @@ private ManagedBuffer getSortBasedShuffleBlockData(
}
public ManagedBuffer getDiskPersistedRddBlockData(
- ExecutorShuffleInfo executor, int rddId, int splitIndex) {
+ ExecutorShuffleInfo executor, String blockId) {
Review Comment:
Here and some other place seem to be changed the signature of public method / constructor. Shouldn't we change the signature though I don't know whether this is intentionally exposed.
##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/BlockIdUtils.java:
##########
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.spark.network.shuffle;
+
+import org.apache.spark.network.shuffle.checksum.ShuffleChecksumHelper;
+
+public class BlockIdUtils {
+ public static final String SHUFFLE_BLOCK_PREFIX = "shuffle_";
+ public static final String SHUFFLE_CHUNK_PREFIX = "shuffleChunk_";
+ public static final String RDD_BLOCK_PREFIX = "rdd_";
Review Comment:
We already have the pattern of blocks in [object BlockId](https://github.com/apache/spark/blob/336ca8c12a163d31519a491a28d26ff091626986/core/src/main/scala/org/apache/spark/storage/BlockId.scala#L203). Can we reuse this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org