aokolnychyi commented on code in PR #40679:
URL: https://github.com/apache/spark/pull/40679#discussion_r1159133240


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/AlreadyExistException.scala:
##########
@@ -125,23 +204,54 @@ class PartitionsAlreadyExistException(errorClass: String, 
messageParameters: Map
 
   def this(tableName: String, partitionIdent: InternalRow, partitionSchema: 
StructType) =
     this(tableName, Seq(partitionIdent), partitionSchema)
+
+  def this(message: String) = {
+    this(message, errorClass = None, messageParameters = Map.empty[String, 
String])
+  }
 }
 
+// any changes to this class should be backward compatible as it may be used 
by external connectors
 class FunctionAlreadyExistsException(errorClass: String, messageParameters: 
Map[String, String])
   extends AnalysisException(errorClass, messageParameters) {
 
   def this(function: Seq[String]) = {
     this (errorClass = "ROUTINE_ALREADY_EXISTS",
       Map("routineName" -> quoteNameParts(function)))
   }
+
+  def this(db: String, func: String) = {
+    this(Seq(db, func))
+  }
 }
 
-class IndexAlreadyExistsException(
-    indexName: String,
-    tableName: String,
-    cause: Option[Throwable] = None)
+// any changes to this class should be backward compatible as it may be used 
by external connectors
+class IndexAlreadyExistsException private(
+    message: String,
+    cause: Option[Throwable],
+    errorClass: Option[String],
+    messageParameters: Map[String, String])
   extends AnalysisException(
-    errorClass = "INDEX_ALREADY_EXISTS",
-    Map("indexName" -> indexName, "tableName" -> tableName),
-    cause
-  )
+    message,
+    cause = cause,
+    errorClass = errorClass,
+    messageParameters = messageParameters) {
+
+  def this(
+      errorClass: String,
+      messageParameters: Map[String, String],
+      cause: Option[Throwable]) = {

Review Comment:
   I could not keep the default value for `cause` as the old constructor 
already uses a default value. We can't have multiple constructors with default 
values.



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

Reply via email to