imarkowitz commented on code in PR #52256:
URL: https://github.com/apache/spark/pull/52256#discussion_r2350208948


##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -46,24 +46,28 @@ class ErrorClassesJsonReader(jsonFileURLs: Seq[URL]) {
       case (key, value) => key -> value
     }
     val sub = new StringSubstitutor(sanitizedParameters)
-    val errorMessage = try {
-      sub.replace(ErrorClassesJsonReader.TEMPLATE_REGEX.replaceAllIn(
-        messageTemplate, "\\$\\{$1\\}"))
-    } catch {
-      case i: IllegalArgumentException => throw SparkException.internalError(
-        s"Undefined error message parameter for error class: '$errorClass', " +
-          s"MessageTemplate: $messageTemplate, " +
-          s"Parameters: $messageParameters", i)
-    }
+    val errorMessage =
+      try {
+        sub.replace(
+          ErrorClassesJsonReader.TEMPLATE_REGEX.replaceAllIn(messageTemplate, 
"\\$\\{$1\\}"))
+      } catch {
+        case i: IllegalArgumentException =>
+          throw SparkException.internalError(
+            s"Undefined error message parameter for error class: 
'$errorClass', " +
+              s"MessageTemplate: $messageTemplate, " +
+              s"Parameters: $messageParameters",
+            i)
+      }
     if (util.SparkEnvUtils.isTesting) {
-      val placeHoldersNum = 
ErrorClassesJsonReader.TEMPLATE_REGEX.findAllIn(messageTemplate).length
+      val placeHoldersNum =

Review Comment:
   Reverted



##########
common/utils/src/main/java/org/apache/spark/SparkThrowable.java:
##########
@@ -60,6 +61,11 @@ default boolean isInternalError() {
     return SparkThrowableHelper.isInternalError(this.getCondition());
   }
 
+  default Optional<BreakingChangeInfo> getBreakingChangeInfo() {

Review Comment:
   Done



##########
common/utils/src/main/scala/org/apache/spark/SparkThrowableHelper.scala:
##########
@@ -37,15 +37,11 @@ private[spark] object SparkThrowableHelper {
     // of this ticket: https://issues.apache.org/jira/browse/SPARK-47429
     
Seq(SparkClassUtils.getSparkClassLoader.getResource("error/error-conditions.json")))
 
-  def getMessage(
-      errorClass: String,
-      messageParameters: Map[String, String]): String = {
+  def getMessage(errorClass: String, messageParameters: Map[String, String]): 
String = {

Review Comment:
   Done. These were auto-generated from running `./dev/scalafmt` -- is there a 
better workflow for formatting these changes?



##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -143,39 +165,81 @@ private object ErrorClassesJsonReader {
 /**
  * Information associated with an error class.
  *
- * @param sqlState SQLSTATE associated with this class.
- * @param subClass SubClass associated with this class.
- * @param message Message format with optional placeholders (e.g. 
&lt;parm&gt;).
- *                The error message is constructed by concatenating the lines 
with newlines.
+ * @param sqlState
+ *   SQLSTATE associated with this class.
+ * @param subClass
+ *   SubClass associated with this class.
+ * @param message
+ *   Message format with optional placeholders (e.g. &lt;parm&gt;). The error 
message is
+ *   constructed by concatenating the lines with newlines.
+ * @param breakingChangeInfo
+ *   Additional metadata if the error is due to a breaking change.
  */
 private case class ErrorInfo(
     message: Seq[String],
     subClass: Option[Map[String, ErrorSubInfo]],
-    sqlState: Option[String]) {
+    sqlState: Option[String],
+    breakingChangeInfo: Option[BreakingChangeInfo] = None) {
   // For compatibility with multi-line error messages
   @JsonIgnore
-  val messageTemplate: String = message.mkString("\n")
+  val messageTemplate: String = message.mkString("\n") +

Review Comment:
   I think it makes sense to use a space



##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -46,24 +46,28 @@ class ErrorClassesJsonReader(jsonFileURLs: Seq[URL]) {
       case (key, value) => key -> value
     }
     val sub = new StringSubstitutor(sanitizedParameters)
-    val errorMessage = try {
-      sub.replace(ErrorClassesJsonReader.TEMPLATE_REGEX.replaceAllIn(
-        messageTemplate, "\\$\\{$1\\}"))
-    } catch {
-      case i: IllegalArgumentException => throw SparkException.internalError(
-        s"Undefined error message parameter for error class: '$errorClass', " +
-          s"MessageTemplate: $messageTemplate, " +
-          s"Parameters: $messageParameters", i)
-    }
+    val errorMessage =

Review Comment:
   Reverted



-- 
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