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

    https://github.com/apache/spark/pull/12081#discussion_r59086818
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -194,7 +222,38 @@ class DDLSuite extends QueryTest with SharedSQLContext 
with BeforeAndAfterEach {
         }
       }
     
    -  // TODO: test drop database in restrict mode
    +  test("drop non-empty database in restrict mode") {
    +    val catalog = sqlContext.sessionState.catalog
    +    val dbName = "db1"
    +    sql(s"CREATE DATABASE $dbName")
    +
    +    // create a table in database
    +    val tableIdent1 = TableIdentifier("tab1", Some(dbName))
    +    createTable(catalog, tableIdent1)
    +
    +    // drop a non-empty database in Restrict mode
    +    val message = intercept[AnalysisException] {
    +      sql(s"DROP DATABASE $dbName RESTRICT")
    +    }.getMessage
    +    assert(message.contains(s"Database '$dbName' is not empty. One or more 
tables exist"))
    +
    +    dropTable(catalog, tableIdent1)
    +    sql(s"DROP DATABASE $dbName RESTRICT")
    +  }
    --- End diff --
    
    We need to check this db is removed, right?


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