Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/19888#discussion_r154883267
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
@@ -203,14 +203,16 @@ case class DropTableCommand(
case _ =>
}
}
- try {
-
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName))
- } catch {
- case _: NoSuchTableException if ifExists =>
- case NonFatal(e) => log.warn(e.toString, e)
+
+ if (!ifExists || catalog.tableExists(tableName)) {
--- End diff --
I feel it's more readable to write
```
if (catalog.tableExists(tableName)) {
... do the drop
} else if (ifExists) {
// do nothing
} else {
// log.warn("The table to drop does not exist: " +tableName)
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]