Skip to content

Commit

Permalink
[SPARK-42656][SPARK SHELL][CONNECT][FOLLOWUP] Add same `ClassNotFound…
Browse files Browse the repository at this point in the history
…Exception` 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 apache#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 apache#40318 from LuciferYang/SPARK-42656-FOLLOWUP.

Authored-by: yangjie01 <[email protected]>
Signed-off-by: Herman van Hovell <[email protected]>
  • Loading branch information
LuciferYang authored and hvanhovell committed Mar 7, 2023
1 parent 2e7207f commit 67328de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions repl/src/main/scala-2.13/org/apache/spark/repl/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 67328de

Please sign in to comment.