karenfeng commented on a change in pull request #31619:
URL: https://github.com/apache/spark/pull/31619#discussion_r586053025
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropNamespaceExec.scala
##########
@@ -43,17 +42,15 @@ case class DropNamespaceExec(
if (!cascade) {
if (catalog.asTableCatalog.listTables(ns).nonEmpty
|| nsCatalog.listNamespaces(ns).nonEmpty) {
- throw new SparkException(
- s"Cannot drop a non-empty namespace: ${namespace.quoted}. " +
- "Use CASCADE option to drop a non-empty namespace.")
+ throw
QueryExecutionErrors.cannotDropNonemptyNamespaceError(namespace)
}
}
if (!nsCatalog.dropNamespace(ns)) {
- throw new SparkException(s"Failed to drop a namespace:
${namespace.quoted}.")
+ throw QueryExecutionErrors.cannotDropNonemptyNamespaceError(namespace)
}
} else if (!ifExists) {
- throw new NoSuchNamespaceException(ns)
+ throw QueryCompilationErrors.noSuchNamespaceError(ns)
Review comment:
If I read the [root
ticket](https://issues.apache.org/jira/browse/SPARK-33539) correctly, all
`AnalysisException`s should end up in `QueryCompilationErrors`:
```
A general rule of thumb for grouping exceptions:
AnalysisException => QueryCompilationErrors
SparkException, RuntimeException(UnsupportedOperationException,
IllegalStateException...) => QueryExecutionErrors
ParseException => QueryParsingErrors
```
Do you believe this rule of thumb does not apply here?
----------------------------------------------------------------
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]