beliefer commented on a change in pull request #30870:
URL: https://github.com/apache/spark/pull/30870#discussion_r547796579



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryCompilationErrors.scala
##########
@@ -501,4 +505,171 @@ object QueryCompilationErrors {
   def commandNotSupportNestedColumnError(command: String, quoted: String): 
Throwable = {
     new AnalysisException(s"$command does not support nested column: $quoted")
   }
+
+  def renameTempViewToExistsViewError(oldName: String, newName: String): 
Throwable = {
+    new AnalysisException(
+      s"rename temporary view from '$oldName' to '$newName': destination view 
already exists")
+  }
+
+  def databaseExistTableError(db: String): Throwable = {
+    new AnalysisException(s"Database $db is not empty. One or more tables 
exist.")
+  }
+
+  def databaseExistFunctionError(db: String): Throwable = {
+    new AnalysisException(s"Database '$db' is not empty. One or more functions 
exist.")
+  }
+
+  def invalidNameForTableOrDatabaseError(name: String): Throwable = {
+    new AnalysisException(s"`$name` is not a valid name for tables/databases. 
" +
+      "Valid names only contain alphabet characters, numbers and _.")
+  }
+
+  def cannotCreateDatabaseWithSameNameAsPreservedDatabaseError(database: 
String): Throwable = {
+    new AnalysisException(s"$database is a system preserved database, " +
+      "you cannot create a database with this name.")
+  }
+
+  def cannotDropDefaultDatabaseError(): Throwable = {
+    new AnalysisException("Can not drop default database")
+  }
+
+  def cannotUsePreservedDatabaseAsCurrentDatabaseError(database: String): 
Throwable = {
+    new AnalysisException(s"$database is a system preserved database, you 
cannot use it as " +
+      "current database. To access global temporary views, you should use 
qualified name with " +
+      s"the GLOBAL_TEMP_DATABASE, e.g. SELECT * FROM $database.viewName.")
+  }
+
+  def createExternalTableWithoutLocationError(): Throwable = {
+    new AnalysisException("CREATE EXTERNAL TABLE must be accompanied by 
LOCATION")
+  }
+
+  def cannotOperateManagedTableWithExistsLocationError(
+      methodName: String, tableIdentifier: TableIdentifier, tableLocation: 
Path): Throwable = {
+    new AnalysisException(s"Can not $methodName the managed 
table('$tableIdentifier')" +
+      s". The associated location('${tableLocation.toString}') already 
exists.")
+  }
+
+  def alterTableDropColumnsNotSupportedError(
+      nonExistentColumnNames: Seq[String]): Throwable = {
+    new AnalysisException(
+      s"""
+         |Some existing schema fields (${nonExistentColumnNames.mkString("[", 
",", "]")}) are
+         |not present in the new schema. We don't support dropping columns yet.
+         """.stripMargin)
+  }
+
+  def cannotRetrieveTableOrViewNotInSomeDatabaseError(
+      qualifiedTableNames: Seq[QualifiedTableName]): Throwable = {
+    new AnalysisException("Only the tables/views belong to the same database 
can be retrieved. " +
+      s"Querying tables/views are $qualifiedTableNames")
+  }
+
+  def renameTableSourceAndDestinationMismatchError(db: String, newDb: String): 
Throwable = {
+    new AnalysisException(
+      s"RENAME TABLE source and destination databases do not match: '$db' != 
'$newDb'")
+  }
+
+  def renameTempViewSpecifyDestinationDatabaseNotAllowedError(
+      oldName: TableIdentifier, newName: TableIdentifier): Throwable = {
+    new AnalysisException(s"RENAME TEMPORARY VIEW from '$oldName' to 
'$newName': cannot " +
+      s"specify database name '${newName.database.get}' in the destination 
table")
+  }
+
+  def renameTempViewToExistingDestinationTableError(
+      oldName: TableIdentifier, newName: TableIdentifier): Throwable = {
+    new AnalysisException(s"RENAME TEMPORARY VIEW from '$oldName' to 
'$newName': " +
+      "destination table already exists")
+  }
+
+  def invalidPartitionSpecContainsEmptyValueError(spec: String): Throwable = {
+    new AnalysisException(
+      s"Partition spec is invalid. The spec ($spec) contains an empty 
partition column value")
+  }
+
+  def partitionSpecNotContainedInDefinedPartitionSpecError(

Review comment:
       Where is `invalidPartitionSpecError`?




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

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