cloud-fan commented on code in PR #52256:
URL: https://github.com/apache/spark/pull/52256#discussion_r2378561779
##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -147,28 +163,59 @@ private object ErrorClassesJsonReader {
* @param subClass SubClass associated with this class.
* @param message Message format with optional placeholders (e.g.
<parm>).
* 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") +
+ breakingChangeInfo.map(_.migrationMessage.mkString(" ", "\n",
"")).getOrElse("")
}
/**
* Information associated with an error subclass.
*
* @param message Message format with optional placeholders (e.g.
<parm>).
* 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 ErrorSubInfo(message: Seq[String]) {
+private case class ErrorSubInfo(
+ message: Seq[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") +
+ breakingChangeInfo.map(_.migrationMessage.mkString(" ", "\n",
"")).getOrElse("")
}
+/**
+ * Additional information if the error was caused by a breaking change.
+ *
+ * @param migrationMessage A message explaining how the user can migrate their
job to work
+ * with the breaking change.
+ * @param mitigationConfig A spark config flag that can be used to mitigate the
+ * breaking change.
+ * @param needsAudit If true, the breaking change should be inspected manually.
+ * If false, the spark job should be retried by setting
the
+ * mitigationConfig.
+ */
+case class BreakingChangeInfo(
Review Comment:
I just realize that we expose it as a public API via
`SparkThrowable.getBreakingChangeInfo`. We shouldn't expose a case class as
public API as it has a wide API surface, including the companion object.
We should follow `SparkThrowable` and define it in Java.
--
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]