Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19888#discussion_r155022526
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
@@ -203,14 +203,20 @@ 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 (catalog.isTemporaryTable(tableName) ||
catalog.tableExists(tableName)) {
+ try {
+
sparkSession.sharedState.cacheManager.uncacheQuery(sparkSession.table(tableName))
+ } catch {
+ case NonFatal(e) => log.warn(e.toString, e)
+ }
+ catalog.refreshTable(tableName)
+ catalog.dropTable(tableName, ifExists, purge)
+ } else if (ifExists) {
+ // no-op
--- End diff --
?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]