cloud-fan commented on code in PR #42985:
URL: https://github.com/apache/spark/pull/42985#discussion_r1336560079
##########
common/utils/src/main/scala/org/apache/spark/ErrorClassesJSONReader.scala:
##########
@@ -85,6 +92,18 @@ class ErrorClassesJsonReader(jsonFileURLs: Seq[URL]) {
.flatMap(_.sqlState)
.orNull
}
+
+ def validateErrorClass(errorClass: String): Boolean = {
+ val errorClasses = errorClass.split("\\.")
+ val result = errorClasses match {
+ case Array(mainClass) => errorInfoMap.contains(mainClass)
+ case Array(mainClass, subClass) => errorInfoMap.get(mainClass).map {
info =>
+ info.subClass.get.contains(subClass)
+ }.getOrElse(false)
+ case _ => false
+ }
+ result
Review Comment:
```suggestion
errorClasses match {
case Array(mainClass) => errorInfoMap.contains(mainClass)
case Array(mainClass, subClass) => errorInfoMap.get(mainClass).map {
info =>
info.subClass.get.contains(subClass)
}.getOrElse(false)
case _ => false
}
```
--
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]