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

    https://github.com/apache/spark/pull/12121#discussion_r58428893
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala 
---
    @@ -159,6 +193,187 @@ class DDLSuite extends QueryTest with 
SharedSQLContext {
         }
       }
     
    +  // TODO: test drop database in restrict mode
    +
    +  test("alter table: rename") {
    +    val catalog = sqlContext.sessionState.catalog
    +    val tableIdent1 = TableIdentifier("tab1", Some("dbx"))
    +    val tableIdent2 = TableIdentifier("tab2", Some("dbx"))
    +    createDatabase(catalog, "dbx")
    +    createTable(catalog, tableIdent1)
    +    assert(catalog.listTables("dbx") == Seq(tableIdent1))
    +    sql("ALTER TABLE dbx.tab1 RENAME TO dbx.tab2")
    +    assert(catalog.listTables("dbx") == Seq(tableIdent2))
    +    catalog.setCurrentDatabase("dbx")
    +    // rename without explicitly specifying database
    +    sql("ALTER TABLE tab2 RENAME TO tab1")
    +    assert(catalog.listTables("dbx") == Seq(tableIdent1))
    +    // table to rename does not exist
    +    intercept[AnalysisException] {
    +      sql("ALTER TABLE dbx.does_not_exist RENAME TO dbx.tab2")
    +    }
    +    // destination database is different
    +    intercept[AnalysisException] {
    +      sql("ALTER TABLE dbx.tab1 RENAME TO dby.tab2")
    --- End diff --
    
    no


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