MaxGekk commented on code in PR #44953:
URL: https://github.com/apache/spark/pull/44953#discussion_r1471611997
##########
common/utils/src/main/scala/org/apache/spark/SparkThrowableHelper.scala:
##########
@@ -74,6 +74,26 @@ private[spark] object SparkThrowableHelper {
errorClass.startsWith("INTERNAL_ERROR")
}
+ def isRuntimeUserError(e: Throwable): Boolean = {
+ e match {
+ case st: SparkThrowable if st.getErrorClass != null =>
+ st.getErrorClass match {
+ case "DIVIDE_BY_ZERO" | "INTERVAL_DIVIDED_BY_ZERO" => true
+ case "ARITHMETIC_OVERFLOW" | "BINARY_ARITHMETIC_OVERFLOW" |
"CAST_OVERFLOW" |
+ "CAST_OVERFLOW_IN_TABLE_INSERT" | "DATETIME_OVERFLOW" |
+ "INTERVAL_ARITHMETIC_OVERFLOW" => true
+ case "CAST_INVALID_INPUT" | "NUMERIC_VALUE_OUT_OF_RANGE" |
"CANNOT_PARSE_TIMESTAMP" =>
+ true
+ case "INVALID_ARRAY_INDEX" | "INVALID_ARRAY_INDEX_IN_ELEMENT_AT" |
+ "INVALID_INDEX_OF_ZERO" => true
+ // TODO: add more user-facing runtime errors (mostly ANSI errors).
Review Comment:
How about to create a `Map`, and to check the given error class in it. Code
will be more maintainable and faster.
--
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]