You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ma...@apache.org on 2015/02/18 22:59:58 UTC

spark git commit: [SPARK-4903][SQL]Backport the bug fix for SPARK-4903

Repository: spark
Updated Branches:
  refs/heads/branch-1.2 068ba45cf -> 36e15b48e


[SPARK-4903][SQL]Backport the bug fix for SPARK-4903

The original fix was a part of https://issues.apache.org/jira/browse/SPARK-4912 (commit https://github.com/apache/spark/commit/6463e0b9e8067cce70602c5c9006a2546856a9d6).

Author: Yin Huai <yh...@databricks.com>

Closes #4671 from yhuai/SPARK-4903-1.2 and squashes the following commits:

3168b4b [Yin Huai] Uncache table in drop table command.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/36e15b48
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/36e15b48
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/36e15b48

Branch: refs/heads/branch-1.2
Commit: 36e15b48ead360f8b870606add5cf0f7d639f126
Parents: 068ba45
Author: Yin Huai <yh...@databricks.com>
Authored: Wed Feb 18 13:59:55 2015 -0800
Committer: Michael Armbrust <mi...@databricks.com>
Committed: Wed Feb 18 13:59:55 2015 -0800

----------------------------------------------------------------------
 .../org/apache/spark/sql/hive/execution/commands.scala      | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/36e15b48/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala
index a42a7c8..9d52a57 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala
@@ -55,6 +55,15 @@ case class DropTable(tableName: String, ifExists: Boolean) extends LeafNode with
 
   override protected lazy val sideEffectResult: Seq[Row] = {
     val ifExistsClause = if (ifExists) "IF EXISTS " else ""
+    try {
+      hiveContext.tryUncacheQuery(hiveContext.table(tableName))
+    } catch {
+      // This table's metadata is not in
+      case _: org.apache.hadoop.hive.ql.metadata.InvalidTableException =>
+      // Got an error during table lookup or uncache the query. We log the exception message.
+      // Users should be able to drop such kinds of tables regardless if there is an exception.
+      case e: Exception => log.warn(s"${e.getMessage}")
+    }
     hiveContext.runSqlHive(s"DROP TABLE $ifExistsClause$tableName")
     hiveContext.catalog.unregisterTable(Seq(tableName))
     Seq.empty[Row]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org