You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by hv...@apache.org on 2023/03/07 15:13:32 UTC

[spark] branch branch-3.4 updated: [SPARK-42656][SPARK SHELL][CONNECT][FOLLOWUP] Add same `ClassNotFoundException` catch to `repl.Main` for Scala 2.13

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

hvanhovell pushed a commit to branch branch-3.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.4 by this push:
     new f40c1d08e40 [SPARK-42656][SPARK SHELL][CONNECT][FOLLOWUP] Add same `ClassNotFoundException` catch to `repl.Main` for Scala 2.13
f40c1d08e40 is described below

commit f40c1d08e40c47825d1fd1c40a6a32d6a699325e
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Tue Mar 7 11:13:06 2023 -0400

    [SPARK-42656][SPARK SHELL][CONNECT][FOLLOWUP] Add same `ClassNotFoundException` catch to `repl.Main` for Scala 2.13
    
    ### What changes were proposed in this pull request?
    This pr add the same `ClassNotFoundException` catch  to `repl.Main` for Scala 2.13 as https://github.com/apache/spark/pull/40305 due `org/apache/spark/repl/Main.scala` is Scala version sensitive。
    
    ### Why are the changes needed?
    Make sure Scala 2.12 and 2.13 have the same logic
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Manual check
    
    Closes #40318 from LuciferYang/SPARK-42656-FOLLOWUP.
    
    Authored-by: yangjie01 <ya...@baidu.com>
    Signed-off-by: Herman van Hovell <he...@databricks.com>
    (cherry picked from commit 67328de6af54aea22cd17574ff627b77718427b9)
    Signed-off-by: Herman van Hovell <he...@databricks.com>
---
 repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala b/repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala
index 95115934ed1..c8d9be4253d 100644
--- a/repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala
+++ b/repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala
@@ -129,6 +129,11 @@ object Main extends Logging {
       sparkContext = sparkSession.sparkContext
       sparkSession
     } catch {
+      case e: ClassNotFoundException if isShellSession && e.getMessage.contains(
+        "org.apache.spark.sql.connect.SparkConnectPlugin") =>
+        logError("Failed to load spark connect plugin.")
+        logError("You need to build Spark with -Pconnect.")
+        sys.exit(1)
       case e: Exception if isShellSession =>
         logError("Failed to initialize Spark session.", e)
         sys.exit(1)


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