rdblue commented on a change in pull request #25206: [SPARK-28265][SQL] Add renameTable to TableCatalog API URL: https://github.com/apache/spark/pull/25206#discussion_r305554070
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalog/v2/TableCatalogSuite.scala ########## @@ -654,4 +655,68 @@ class TableCatalogSuite extends SparkFunSuite { assert(!wasDropped) assert(!catalog.tableExists(testIdent)) } + + test("renameTable") { + val catalog = newCatalog() + + assert(!catalog.tableExists(testIdent)) + assert(!catalog.tableExists(testIdentNew)) + + catalog.createTable(testIdent, schema, Array.empty, emptyProps) + + assert(catalog.tableExists(testIdent)) + catalog.renameTable(testIdent, testIdentNew) + + assert(!catalog.tableExists(testIdent)) + assert(catalog.tableExists(testIdentNew)) + } + + test("renameTable: table does not exist") { + val catalog = newCatalog() + + val exc = intercept[NoSuchTableException] { + catalog.renameTable(testIdent, testIdentNew) + } + + assert(exc.message.contains(testIdent.quoted)) + assert(exc.message.contains("not found")) + } + + test("renameTable: new table already exists") { Review comment: Nit: should be "fail if new table name already exists" to be more clear. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org