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

yangjie01 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 2da6d1a8731 [SPARK-45337][CORE] Refactor 
`AbstractCommandBuilder#getScalaVersion` to remove the check for Scala 2.12
2da6d1a8731 is described below

commit 2da6d1a8731431d03e8ffce2141d74241f0410dc
Author: yangjie01 <yangji...@baidu.com>
AuthorDate: Wed Sep 27 18:34:09 2023 +0800

    [SPARK-45337][CORE] Refactor `AbstractCommandBuilder#getScalaVersion` to 
remove the check for Scala 2.12
    
    ### What changes were proposed in this pull request?
    This pr refactors `AbstractCommandBuilder#getScalaVersion` function as 
follows:
    1. comment out the code for multiple Scala versions support , making it 
easier to reintroduce when Scala 3 is supported.
    2. Change to directly return `"2.13"` when `scala213.isDirectory()` is true
    
    ### Why are the changes needed?
    Remove Scala 2.12 check
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    - Pass GitHub Actions
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #43125 from LuciferYang/SPARK-45337.
    
    Authored-by: yangjie01 <yangji...@baidu.com>
    Signed-off-by: yangjie01 <yangji...@baidu.com>
---
 .../spark/launcher/AbstractCommandBuilder.java     | 24 +++++++++++++---------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git 
a/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java 
b/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java
index b75410e11a5..2bbeac25c06 100644
--- 
a/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java
+++ 
b/launcher/src/main/java/org/apache/spark/launcher/AbstractCommandBuilder.java
@@ -230,17 +230,21 @@ abstract class AbstractCommandBuilder {
       return scala;
     }
     String sparkHome = getSparkHome();
-    File scala212 = new File(sparkHome, "launcher/target/scala-2.12");
     File scala213 = new File(sparkHome, "launcher/target/scala-2.13");
-    checkState(!scala212.isDirectory() || !scala213.isDirectory(),
-      "Presence of build for multiple Scala versions detected.\n" +
-      "Either clean one of them or set SPARK_SCALA_VERSION in your 
environment.");
-    if (scala213.isDirectory()) {
-      return "2.13";
-    } else {
-      checkState(scala212.isDirectory(), "Cannot find any build directories.");
-      return "2.12";
-    }
+    checkState(scala213.isDirectory(), "Cannot find any build directories.");
+    return "2.13";
+    // String sparkHome = getSparkHome();
+    // File scala212 = new File(sparkHome, "launcher/target/scala-2.12");
+    // File scala213 = new File(sparkHome, "launcher/target/scala-2.13");
+    // checkState(!scala212.isDirectory() || !scala213.isDirectory(),
+    //  "Presence of build for multiple Scala versions detected.\n" +
+    //  "Either clean one of them or set SPARK_SCALA_VERSION in your 
environment.");
+    // if (scala213.isDirectory()) {
+    //  return "2.13";
+    // } else {
+    //  checkState(scala212.isDirectory(), "Cannot find any build 
directories.");
+    //  return "2.12";
+    // }
   }
 
   String getSparkHome() {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to