This is an automated email from the ASF dual-hosted git repository.

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 2eeebef81a11 [SPARK-46957][CORE][FOLLOW-UP] Use Collections.emptyMap 
for Java compatibility
2eeebef81a11 is described below

commit 2eeebef81a11775939fbe327ce357196053728f3
Author: Yi Wu <[email protected]>
AuthorDate: Fri Jun 28 10:47:48 2024 +0800

    [SPARK-46957][CORE][FOLLOW-UP] Use Collections.emptyMap for Java 
compatibility
    
    ### What changes were proposed in this pull request?
    
    This PR replaces `Map.of()` with `Collections.emptyMap()`.
    
    ### Why are the changes needed?
    
    To fix the Java compilation error for branch-3.5/3.4.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Covered by existing tests.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #47121 from Ngone51/SPARK-46957-followup.
    
    Authored-by: Yi Wu <[email protected]>
    Signed-off-by: Kent Yao <[email protected]>
---
 .../spark/shuffle/sort/io/LocalDiskShuffleExecutorComponents.java    | 5 ++++-
 .../scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala   | 4 ++--
 .../java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git 
a/core/src/main/java/org/apache/spark/shuffle/sort/io/LocalDiskShuffleExecutorComponents.java
 
b/core/src/main/java/org/apache/spark/shuffle/sort/io/LocalDiskShuffleExecutorComponents.java
index 861a8e623a6e..38f0a60f8b0d 100644
--- 
a/core/src/main/java/org/apache/spark/shuffle/sort/io/LocalDiskShuffleExecutorComponents.java
+++ 
b/core/src/main/java/org/apache/spark/shuffle/sort/io/LocalDiskShuffleExecutorComponents.java
@@ -17,6 +17,7 @@
 
 package org.apache.spark.shuffle.sort.io;
 
+import java.util.Collections;
 import java.util.Map;
 import java.util.Optional;
 
@@ -57,7 +58,9 @@ public class LocalDiskShuffleExecutorComponents implements 
ShuffleExecutorCompon
       throw new IllegalStateException("No blockManager available from the 
SparkEnv.");
     }
     blockResolver =
-      new IndexShuffleBlockResolver(sparkConf, blockManager, Map.of() /* 
Shouldn't be accessed */);
+      new IndexShuffleBlockResolver(
+        sparkConf, blockManager, Collections.emptyMap() /* Shouldn't be 
accessed */
+      );
   }
 
   @Override
diff --git 
a/core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala 
b/core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala
index 20b8d0809f32..7a76c2f97e8d 100644
--- 
a/core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala
+++ 
b/core/src/main/scala/org/apache/spark/shuffle/IndexShuffleBlockResolver.scala
@@ -21,7 +21,7 @@ import java.io._
 import java.nio.ByteBuffer
 import java.nio.channels.Channels
 import java.nio.file.Files
-import java.util.{Map => JMap}
+import java.util.{Collections, Map => JMap}
 
 import scala.collection.mutable.ArrayBuffer
 
@@ -58,7 +58,7 @@ private[spark] class IndexShuffleBlockResolver(
     conf: SparkConf,
     // var for testing
     var _blockManager: BlockManager = null,
-    val taskIdMapsForShuffle: JMap[Int, OpenHashSet[Long]] = JMap.of())
+    val taskIdMapsForShuffle: JMap[Int, OpenHashSet[Long]] = 
Collections.emptyMap())
   extends ShuffleBlockResolver
   with Logging with MigratableResolver {
 
diff --git 
a/core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java
 
b/core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java
index fac84b2e9187..d95d648c2d73 100644
--- 
a/core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java
+++ 
b/core/src/test/java/org/apache/spark/shuffle/sort/UnsafeShuffleWriterSuite.java
@@ -315,7 +315,7 @@ public class UnsafeShuffleWriterSuite implements 
ShuffleChecksumTestHelper {
   @Test
   public void writeChecksumFileWithoutSpill() throws Exception {
     IndexShuffleBlockResolver blockResolver =
-      new IndexShuffleBlockResolver(conf, blockManager, Map.of());
+      new IndexShuffleBlockResolver(conf, blockManager, 
Collections.emptyMap());
     ShuffleChecksumBlockId checksumBlockId =
       new ShuffleChecksumBlockId(0, 0, 
IndexShuffleBlockResolver.NOOP_REDUCE_ID());
     String checksumAlgorithm = 
conf.get(package$.MODULE$.SHUFFLE_CHECKSUM_ALGORITHM());
@@ -346,7 +346,7 @@ public class UnsafeShuffleWriterSuite implements 
ShuffleChecksumTestHelper {
   @Test
   public void writeChecksumFileWithSpill() throws Exception {
     IndexShuffleBlockResolver blockResolver =
-      new IndexShuffleBlockResolver(conf, blockManager, Map.of());
+      new IndexShuffleBlockResolver(conf, blockManager, 
Collections.emptyMap());
     ShuffleChecksumBlockId checksumBlockId =
       new ShuffleChecksumBlockId(0, 0, 
IndexShuffleBlockResolver.NOOP_REDUCE_ID());
     String checksumAlgorithm = 
conf.get(package$.MODULE$.SHUFFLE_CHECKSUM_ALGORITHM());


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to