panbingkun commented on code in PR #36676:
URL: https://github.com/apache/spark/pull/36676#discussion_r895178269


##########
core/src/main/scala/org/apache/spark/ErrorInfo.scala:
##########
@@ -61,13 +77,25 @@ private[spark] object SparkThrowableHelper {
       queryContext: String = ""): String = {
     val errorInfo = errorClassToInfoMap.getOrElse(errorClass,
       throw new IllegalArgumentException(s"Cannot find error class 
'$errorClass'"))
+    val (displayClass, displayMessageParameters, displayFormat) = if 
(errorInfo.subClass.isEmpty) {
+      (errorClass, messageParameters, errorInfo.messageFormat)
+    } else {
+      val subClass = errorInfo.subClass.get
+      val subErrorClass = messageParameters.head
+      val errorSubInfo = subClass.getOrElse(subErrorClass,
+        throw new IllegalArgumentException(s"Cannot find sub error class 
'$subErrorClass'"))
+      (errorClass + "." + subErrorClass, messageParameters.tail,
+        errorInfo.messageFormat + " " + errorSubInfo.messageFormat)
+    }
+    val displayMessage = String.format(
+      displayFormat.replaceAll("<[a-zA-Z0-9_-]+>", "%s"),
+      displayMessageParameters : _*)
     val displayQueryContext = if (queryContext.isEmpty) {

Review Comment:
   ok, i will close it and open new pr for it!
   new pr: https://github.com/apache/spark/pull/36852



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to