Github user jayadevanmurali commented on a diff in the pull request:
https://github.com/apache/spark/pull/16083#discussion_r90372901
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
@@ -189,14 +189,18 @@ case class DropTableCommand(
if (!catalog.isTemporaryTable(tableName) &&
catalog.tableExists(tableName)) {
// If the command DROP VIEW is to drop a table or DROP TABLE is to
drop a view
// issue an exception.
- catalog.getTableMetadata(tableName).tableType match {
- case CatalogTableType.VIEW if !isView =>
- throw new AnalysisException(
- "Cannot drop a view with DROP TABLE. Please use DROP VIEW
instead")
- case o if o != CatalogTableType.VIEW && isView =>
- throw new AnalysisException(
- s"Cannot drop a table with DROP VIEW. Please use DROP TABLE
instead")
- case _ =>
+ try {
+ catalog.getTableMetadata(tableName).tableType match {
+ case CatalogTableType.VIEW if !isView =>
+ throw new AnalysisException(
+ "Cannot drop a view with DROP TABLE. Please use DROP VIEW
instead")
+ case o if o != CatalogTableType.VIEW && isView =>
+ throw new AnalysisException(
+ s"Cannot drop a table with DROP VIEW. Please use DROP TABLE
instead")
+ case _ =>
+ }
+ } catch {
+ case e: QueryExecutionException => log.warn(e.toString, e)
--- End diff --
Hi @gatorsmile, I tested this change against all existing test cases. Also
@davies mentioned in the jira itself, we cannot purposefully corrupt the meta
data. So I tested and verified, this change will not break any existing test
cases. And we are expecting QueryExecutionException when the meta data is get
corrupted in some way.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]