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

ruifengz 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 47d9fbd407d [SPARK-41532][CONNECT][FOLLOWUP] Make the scala client 
using the same error class as python client
47d9fbd407d is described below

commit 47d9fbd407d1b7148ae16c781facc2d9d663fc16
Author: Jiaan Geng <belie...@163.com>
AuthorDate: Wed Aug 2 12:48:48 2023 +0800

    [SPARK-41532][CONNECT][FOLLOWUP] Make the scala client using the same error 
class as python client
    
    ### What changes were proposed in this pull request?
    The python connect client define the error class in `error_classes.py`.
    `SESSION_NOT_SAME` is an error class used to check the `SparkSession` of 
one dataset is the same the other dataset. Please refer [`error_classes.py` 
](https://github.com/apache/spark/blob/546e39c5dabc1111243ab81b6238dc893d9993e0/python/pyspark/errors/error_classes.py#L678C1-L678C1)
    But the scala connect client not the the same error class.
    
    ### Why are the changes needed?
    This PR make the scala client using the same error class as python client.
    
    ### Does this PR introduce _any_ user-facing change?
    'No'.
    Just update the inner implementation.
    
    ### How was this patch tested?
    Exists test cases.
    
    Closes #42256 from beliefer/SPARK-41532_followup.
    
    Authored-by: Jiaan Geng <belie...@163.com>
    Signed-off-by: Ruifeng Zheng <ruife...@apache.org>
---
 common/utils/src/main/resources/error/error-classes.json             | 5 +++++
 .../client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala     | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/common/utils/src/main/resources/error/error-classes.json 
b/common/utils/src/main/resources/error/error-classes.json
index 06c47419fcb..7012c66c895 100644
--- a/common/utils/src/main/resources/error/error-classes.json
+++ b/common/utils/src/main/resources/error/error-classes.json
@@ -409,6 +409,11 @@
         "message" : [
           "Error instantiating Spark Connect plugin: <msg>"
         ]
+      },
+      "SESSION_NOT_SAME" : {
+        "message" : [
+          "Both Datasets must belong to the same SparkSession."
+        ]
       }
     }
   },
diff --git 
a/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala
 
b/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala
index b0dd91293a0..0f7b376955c 100644
--- 
a/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala
+++ 
b/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/Dataset.scala
@@ -1750,7 +1750,10 @@ class Dataset[T] private[sql] (
 
   private def checkSameSparkSession(other: Dataset[_]): Unit = {
     if (this.sparkSession.sessionId != other.sparkSession.sessionId) {
-      throw new SparkException("Both Datasets must belong to the same 
SparkSession")
+      throw new SparkException(
+        errorClass = "CONNECT.SESSION_NOT_SAME",
+        messageParameters = Map.empty,
+        cause = null)
     }
   }
 


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

Reply via email to