Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-35629][SQL] Use better exception type if database doesn't exis…
…t on `drop database` ### What changes were proposed in this pull request? Add database if exists check in `SeesionCatalog` ### Why are the changes needed? Curently execute `drop database test` will throw unfriendly error msg. ``` Error in query: org.apache.hadoop.hive.metastore.api.NoSuchObjectException: test org.apache.spark.sql.AnalysisException: org.apache.hadoop.hive.metastore.api.NoSuchObjectException: test at org.apache.spark.sql.hive.HiveExternalCatalog.withClient(HiveExternalCatalog.scala:112) at org.apache.spark.sql.hive.HiveExternalCatalog.dropDatabase(HiveExternalCatalog.scala:200) at org.apache.spark.sql.catalyst.catalog.ExternalCatalogWithListener.dropDatabase(ExternalCatalogWithListener.scala:53) at org.apache.spark.sql.catalyst.catalog.SessionCatalog.dropDatabase(SessionCatalog.scala:273) at org.apache.spark.sql.execution.command.DropDatabaseCommand.run(ddl.scala:111) at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:75) at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:73) at org.apache.spark.sql.execution.command.ExecutedCommandExec.executeCollect(commands.scala:84) at org.apache.spark.sql.Dataset.$anonfun$logicalPlan$1(Dataset.scala:228) at org.apache.spark.sql.Dataset.$anonfun$withAction$1(Dataset.scala:3707) ``` ### Does this PR introduce _any_ user-facing change? Yes, more cleaner error msg. ### How was this patch tested? Add test. Closes #32768 from ulysses-you/SPARK-35629. Authored-by: ulysses-you <ulyssesyou18@gmail.com> Signed-off-by: Gengliang Wang <gengliang@apache.org>
- Loading branch information