gengliangwang commented on code in PR #40679:
URL: https://github.com/apache/spark/pull/40679#discussion_r1159264585
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AlreadyExistException.scala:
##########
@@ -32,34 +33,81 @@ import org.apache.spark.sql.types.StructType
class DatabaseAlreadyExistsException(db: String)
extends NamespaceAlreadyExistsException(Array(db))
+// any changes to this class should be backward compatible as it may be used
by external connectors
+class NamespaceAlreadyExistsException private(
+ message: String,
+ errorClass: Option[String],
+ messageParameters: Map[String, String])
+ extends AnalysisException(
+ message,
+ errorClass = errorClass,
+ messageParameters = messageParameters) {
+
+ def this(errorClass: String, messageParameters: Map[String, String]) = {
+ this(
+ SparkThrowableHelper.getMessage(errorClass, messageParameters),
+ Some(errorClass),
+ messageParameters)
+ }
-class NamespaceAlreadyExistsException(errorClass: String, messageParameters:
Map[String, String])
- extends AnalysisException(errorClass, messageParameters) {
def this(namespace: Array[String]) = {
this(errorClass = "SCHEMA_ALREADY_EXISTS",
Map("schemaName" -> quoteNameParts(namespace)))
}
+
+ def this(message: String) = {
+ this(message, errorClass = None, messageParameters = Map.empty[String,
String])
Review Comment:
I wonder whether we should keep the error class `SCHEMA_ALREADY_EXISTS` if
the constructor only contains the message.
Either way is fine to me. This comment won't block merging this PR.
--
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]