Github user yhuai commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14897#discussion_r82493357
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
    @@ -183,17 +183,19 @@ case class DropTableCommand(
     
       override def run(sparkSession: SparkSession): Seq[Row] = {
         val catalog = sparkSession.sessionState.catalog
    -    // If the command DROP VIEW is to drop a table or DROP TABLE is to 
drop a view
    -    // issue an exception.
    -    catalog.getTableMetadataOption(tableName).map(_.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 _ =>
    -    })
    +    if (tableName.database.forall(catalog.databaseExists) && 
catalog.tableExists(tableName)) {
    --- End diff --
    
    I feel `forall` is not easy to understand when you are using it with a 
option.
    



---
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

Reply via email to