MaxGekk commented on code in PR #44468:
URL: https://github.com/apache/spark/pull/44468#discussion_r1437684627


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/utils/ErrorUtils.scala:
##########
@@ -181,7 +182,12 @@ private[connect] object ErrorUtils extends Logging {
         }
         val errorClass = e.getErrorClass
         if (errorClass != null && errorClass.nonEmpty) {
-          errorInfo.putMetadata("errorClass", errorClass)
+          val messageParameters = JsonMethods.compact(
+            
JsonMethods.render(map2jvalue(e.getMessageParameters.asScala.toMap)))
+          if (messageParameters.length <= maxMetadataSize) {
+            errorInfo.putMetadata("errorClass", errorClass)
+            errorInfo.putMetadata("messageParameters", messageParameters)

Review Comment:
   For example https://github.com/MaxGekk/spark/runs/19914247939, the failed 
test `ClientE2ETestSuite.cause exception - false`:
   ```
   sbt.ForkMain$ForkError: org.scalatest.exceptions.TestFailedException: 
Expected exception org.apache.spark.SparkUpgradeException to be thrown, but 
org.apache.spark.SparkException was thrown
   ...
   Caused by: sbt.ForkMain$ForkError: org.apache.spark.SparkException: 
[INTERNAL_ERROR] Undefined error message parameter for error class: 
'INCONSISTENT_BEHAVIOR_CROSS_VERSION.PARSE_DATETIME_BY_NEW_PARSER'. Parameters: 
Map() SQLSTATE: XX000
        at 
org.apache.spark.SparkException$.internalError(SparkException.scala:92)
        at 
org.apache.spark.SparkException$.internalError(SparkException.scala:96)
   ```
   
   How should I create `SparkUpgradeException` if its constructor requires an 
error class and **correct** message parameters (otherwise it fails with the 
internal error)?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to