allisonwang-db commented on a change in pull request #30870:
URL: https://github.com/apache/spark/pull/30870#discussion_r547006225
##########
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 = {
Review comment:
We can combine this one and the above one into
```
databaseNotEmptyError(db: String, details: String)
```
##########
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(
Review comment:
cannotOperateManagedTableWithExistingLocationError(action: String, ...
##########
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 = {
Review comment:
renameTempViewToExistingViewError
##########
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(
Review comment:
cannotRenameTempViewToExistingTableError
##########
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:
We can combine this one and the one above int:
`invalidPartitionSpecError(details: String)`
##########
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(
+ s: TablePartitionSpec, table: CatalogTable): Throwable = {
+ new AnalysisException(
+ s"Partition spec is invalid. The spec (${s.keys.mkString(", ")}) must be
contained " +
+ s"within the partition spec (${table.partitionColumnNames.mkString(",
")}) defined " +
+ s"in table '${table.identifier}'")
+ }
+
+ def invalidFunctionArgumentsError(
Review comment:
This one can be combined with `invalidFunctionArgumentNumberError`
##########
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(
+ s: TablePartitionSpec, table: CatalogTable): Throwable = {
+ new AnalysisException(
+ s"Partition spec is invalid. The spec (${s.keys.mkString(", ")}) must be
contained " +
+ s"within the partition spec (${table.partitionColumnNames.mkString(",
")}) defined " +
+ s"in table '${table.identifier}'")
+ }
+
+ def invalidFunctionArgumentsError(
+ name: String, expectedNumber: Int, actualNumber: Int): Throwable = {
+ new AnalysisException(s"Invalid number of arguments for function $name. " +
+ s"Expected: $expectedNumber; Found: $actualNumber")
+ }
+
+ def functionAlreadyExistsError(func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Function $func already exists")
+ }
+
+ def cannotLoadClassWhenRegisteringFunctionError(
+ className: String, func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Can not load class '$className' when registering "
+
+ s"the function '$func', please make sure it is on the classpath")
+ }
+
+ def v2CatalogNotSupportFunctionError(
+ catalog: String, namespace: Seq[String]): Throwable = {
+ new AnalysisException("V2 catalog does not support functions yet. " +
+ s"catalog: $catalog, namespace: '${namespace.quoted}'")
+ }
+
+ def resourceTypeNotSupportedError(resourceType: String): Throwable = {
+ new AnalysisException(s"Resource Type '$resourceType' is not supported.")
+ }
+
+ def tableNotSpecifyDatabaseError(identifier: TableIdentifier): Throwable = {
+ new AnalysisException(s"table $identifier did not specify database")
+ }
+
+ def tableNotSpecifyLocationUriError(identifier: TableIdentifier): Throwable
= {
+ new AnalysisException(s"table $identifier did not specify locationUri")
+ }
+
+ def partitionNotSpecifyLocationUriError(specString: String): Throwable = {
+ new AnalysisException(s"Partition [$specString] did not specify
locationUri")
+ }
+
+ def bucketsNumberNotGreatThanZeroError(bucketingMaxBuckets: Int, numBuckets:
Int): Throwable = {
+ new AnalysisException(
+ s"Number of buckets should be greater than 0 but less than or equal to "
+
+ s"bucketing.maxBuckets (`$bucketingMaxBuckets`). Got `$numBuckets`")
+ }
+
+ def missCatalogAndNamespacePartInCatalogError(numParts: Int, index: Int):
Throwable = {
+ new AnalysisException("Corrupted table name context in catalog: " +
+ s"$numParts parts expected, but part $index is missing.")
+ }
+
+ def corruptedViewSQLConfigsInCatalogError(e: Exception): Throwable = {
+ new AnalysisException("Corrupted view SQL configs in catalog", cause =
Some(e))
+ }
+
+ def missViewQueryOutputColumnsInCatalogError(numCols: String, index: Int):
Throwable = {
Review comment:
corruptedViewQueryOutputColumnsInCatalogError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
Review comment:
unableToDropDatabaseAsFailedToDeleteDirectoryError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
Review comment:
unableToCreateTableAsFailedToCreateDirectoryError
##########
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(
Review comment:
dropNonExistentColumnsNotSupportedError
##########
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(
Review comment:
cannotRenameTempViewWithDatabaseSpecifiedError
##########
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(
Review comment:
cannotRetrieveTableOrViewNotInSameDatabaseError
##########
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(
+ s: TablePartitionSpec, table: CatalogTable): Throwable = {
+ new AnalysisException(
+ s"Partition spec is invalid. The spec (${s.keys.mkString(", ")}) must be
contained " +
+ s"within the partition spec (${table.partitionColumnNames.mkString(",
")}) defined " +
+ s"in table '${table.identifier}'")
+ }
+
+ def invalidFunctionArgumentsError(
+ name: String, expectedNumber: Int, actualNumber: Int): Throwable = {
+ new AnalysisException(s"Invalid number of arguments for function $name. " +
+ s"Expected: $expectedNumber; Found: $actualNumber")
+ }
+
+ def functionAlreadyExistsError(func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Function $func already exists")
+ }
+
+ def cannotLoadClassWhenRegisteringFunctionError(
+ className: String, func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Can not load class '$className' when registering "
+
+ s"the function '$func', please make sure it is on the classpath")
+ }
+
+ def v2CatalogNotSupportFunctionError(
+ catalog: String, namespace: Seq[String]): Throwable = {
+ new AnalysisException("V2 catalog does not support functions yet. " +
+ s"catalog: $catalog, namespace: '${namespace.quoted}'")
+ }
+
+ def resourceTypeNotSupportedError(resourceType: String): Throwable = {
+ new AnalysisException(s"Resource Type '$resourceType' is not supported.")
+ }
+
+ def tableNotSpecifyDatabaseError(identifier: TableIdentifier): Throwable = {
+ new AnalysisException(s"table $identifier did not specify database")
+ }
+
+ def tableNotSpecifyLocationUriError(identifier: TableIdentifier): Throwable
= {
+ new AnalysisException(s"table $identifier did not specify locationUri")
+ }
+
+ def partitionNotSpecifyLocationUriError(specString: String): Throwable = {
+ new AnalysisException(s"Partition [$specString] did not specify
locationUri")
+ }
+
+ def bucketsNumberNotGreatThanZeroError(bucketingMaxBuckets: Int, numBuckets:
Int): Throwable = {
Review comment:
It seems here the error is saying the bucket number is not in a valid
range. We can probably change this to:
`invalidBucketNumberError `
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
Review comment:
unableToCreateDatabaseAsFailedToCreateDirectoryError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
Review comment:
unableToDeletePartitionPathError
##########
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(
+ s: TablePartitionSpec, table: CatalogTable): Throwable = {
+ new AnalysisException(
+ s"Partition spec is invalid. The spec (${s.keys.mkString(", ")}) must be
contained " +
+ s"within the partition spec (${table.partitionColumnNames.mkString(",
")}) defined " +
+ s"in table '${table.identifier}'")
+ }
+
+ def invalidFunctionArgumentsError(
+ name: String, expectedNumber: Int, actualNumber: Int): Throwable = {
+ new AnalysisException(s"Invalid number of arguments for function $name. " +
+ s"Expected: $expectedNumber; Found: $actualNumber")
+ }
+
+ def functionAlreadyExistsError(func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Function $func already exists")
+ }
+
+ def cannotLoadClassWhenRegisteringFunctionError(
+ className: String, func: FunctionIdentifier): Throwable = {
+ new AnalysisException(s"Can not load class '$className' when registering "
+
+ s"the function '$func', please make sure it is on the classpath")
+ }
+
+ def v2CatalogNotSupportFunctionError(
+ catalog: String, namespace: Seq[String]): Throwable = {
+ new AnalysisException("V2 catalog does not support functions yet. " +
+ s"catalog: $catalog, namespace: '${namespace.quoted}'")
+ }
+
+ def resourceTypeNotSupportedError(resourceType: String): Throwable = {
+ new AnalysisException(s"Resource Type '$resourceType' is not supported.")
+ }
+
+ def tableNotSpecifyDatabaseError(identifier: TableIdentifier): Throwable = {
+ new AnalysisException(s"table $identifier did not specify database")
+ }
+
+ def tableNotSpecifyLocationUriError(identifier: TableIdentifier): Throwable
= {
+ new AnalysisException(s"table $identifier did not specify locationUri")
+ }
+
+ def partitionNotSpecifyLocationUriError(specString: String): Throwable = {
+ new AnalysisException(s"Partition [$specString] did not specify
locationUri")
+ }
+
+ def bucketsNumberNotGreatThanZeroError(bucketingMaxBuckets: Int, numBuckets:
Int): Throwable = {
+ new AnalysisException(
+ s"Number of buckets should be greater than 0 but less than or equal to "
+
+ s"bucketing.maxBuckets (`$bucketingMaxBuckets`). Got `$numBuckets`")
+ }
+
+ def missCatalogAndNamespacePartInCatalogError(numParts: Int, index: Int):
Throwable = {
Review comment:
corruptedTableNameContextInCatalogError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
+ table: String, dir: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop table $table as failed " +
+ s"to delete its directory $dir", e)
+ }
+
+ def unableRenameTableAsFailedRenameDirectoryError(
+ oldName: String, newName: String, oldDir: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename table $oldName to $newName as failed
" +
+ s"to rename its directory $oldDir", e)
+ }
+
+ def unableCreatePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
Review comment:
unableToCreatePartitionPathError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
Review comment:
unableToDropTableAsFailedToDeleteDirectoryError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
+ table: String, dir: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop table $table as failed " +
+ s"to delete its directory $dir", e)
+ }
+
+ def unableRenameTableAsFailedRenameDirectoryError(
Review comment:
unableToRenameTableAsFailedToRenameDirectoryError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
+ table: String, dir: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop table $table as failed " +
+ s"to delete its directory $dir", e)
+ }
+
+ def unableRenameTableAsFailedRenameDirectoryError(
+ oldName: String, newName: String, oldDir: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename table $oldName to $newName as failed
" +
+ s"to rename its directory $oldDir", e)
+ }
+
+ def unableCreatePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to create partition path $partitionPath", e)
+ }
+
+ def unableRenamePartitionPathError(oldPartPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename partition path $oldPartPath", e)
+ }
+
+ def methodNotImplementedError(methodName: String): Throwable = {
+ new UnsupportedOperationException(s"$methodName is not implemented")
+ }
+
+ def cannotReadCorruptedTablePropertyError(key: String): Throwable = {
+ new AnalysisException(s"Cannot read table property '$key' as it's
corrupted.")
+ }
+
+ def cannotReadCorruptedTablePropertyAsMissPartError(
+ key: String, index: Int, numParts: String): Throwable = {
+ new AnalysisException(s"Cannot read table property '$key' as it's
corrupted." +
+ s"Missing part $index, $numParts parts are expected.")
+ }
+
+ def tableStatsMustSpecifiedError(): Throwable = {
Review comment:
tableStatsNotSpecifiedError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
+ table: String, dir: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop table $table as failed " +
+ s"to delete its directory $dir", e)
+ }
+
+ def unableRenameTableAsFailedRenameDirectoryError(
+ oldName: String, newName: String, oldDir: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename table $oldName to $newName as failed
" +
+ s"to rename its directory $oldDir", e)
+ }
+
+ def unableCreatePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to create partition path $partitionPath", e)
+ }
+
+ def unableRenamePartitionPathError(oldPartPath: Path, e: IOException):
Throwable = {
Review comment:
unableToRenamePartitionPathError
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/QueryExecutionErrors.scala
##########
@@ -56,4 +63,64 @@ object QueryExecutionErrors {
def cannotTerminateGeneratorError(generator: UnresolvedGenerator): Throwable
= {
new UnsupportedOperationException(s"Cannot terminate expression:
$generator")
}
+
+ def unableCreateDatabaseAsFailedCreateDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to create database ${dbDefinition.name} as
failed " +
+ s"to create its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableDropDatabaseAsFailedDeleteDirectoryError(
+ dbDefinition: CatalogDatabase, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop database ${dbDefinition.name} as
failed " +
+ s"to delete its directory ${dbDefinition.locationUri}", e)
+ }
+
+ def unableCreateTableAsFailedCreateDirectoryError(
+ table: String, defaultTableLocation: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to create table $table as failed " +
+ s"to create its directory $defaultTableLocation", e)
+ }
+
+ def unableDeletePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to delete partition path $partitionPath", e)
+ }
+
+ def unableDropTableAsFailedDeleteDirectoryError(
+ table: String, dir: Path, e: IOException): Throwable = {
+ new SparkException(s"Unable to drop table $table as failed " +
+ s"to delete its directory $dir", e)
+ }
+
+ def unableRenameTableAsFailedRenameDirectoryError(
+ oldName: String, newName: String, oldDir: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename table $oldName to $newName as failed
" +
+ s"to rename its directory $oldDir", e)
+ }
+
+ def unableCreatePartitionPathError(partitionPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to create partition path $partitionPath", e)
+ }
+
+ def unableRenamePartitionPathError(oldPartPath: Path, e: IOException):
Throwable = {
+ new SparkException(s"Unable to rename partition path $oldPartPath", e)
+ }
+
+ def methodNotImplementedError(methodName: String): Throwable = {
+ new UnsupportedOperationException(s"$methodName is not implemented")
+ }
+
+ def cannotReadCorruptedTablePropertyError(key: String): Throwable = {
Review comment:
This one can be combined with the next:
`cannotReadCorruptedTablePropertyError(key: String, details: String = "")`
They should also be moved to `QueryCompilationErrors` since they are
AnalysisException.
----------------------------------------------------------------
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]