Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/12146#discussion_r58659065 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala --- @@ -47,18 +48,40 @@ case class AnalyzeTable(tableName: String) extends RunnableCommand { } /** - * Drops a table from the metastore and removes it if it is cached. + * Drops a table/view from the metastore and removes it if it is cached. */ private[hive] case class DropTable( - tableName: String, - ifExists: Boolean) extends RunnableCommand { + tableName: TableIdentifier, + ifExists: Boolean, + isView: Boolean) extends RunnableCommand { override def run(sqlContext: SQLContext): Seq[Row] = { val hiveContext = sqlContext.asInstanceOf[HiveContext] - val ifExistsClause = if (ifExists) "IF EXISTS " else "" + + // If the command DROP VIEW is to drop a table or DROP TABLE is to drop a view + // issue an exception. + val catalogTable: Option[CatalogTable] = try { + // If the table/view does not exist, it will throw an exception: + // - AnalysisException, if it is from InMemoryCatalog. + // - NoSuchTableException, if it is from HiveExternalCatalog + Option(sqlContext.sessionState.catalog.getTable(tableName)) --- End diff -- Sure, will do it.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org