You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/07/19 23:37:24 UTC

[GitHub] [spark] rdblue commented on a change in pull request #25206: [SPARK-28265][SQL] Add renameTable to TableCatalog API

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_r305553873
 
 

 ##########
 File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalog/v2/TestTableCatalog.scala
 ##########
 @@ -88,6 +88,24 @@ class TestTableCatalog extends TableCatalog {
   }
 
   override def dropTable(ident: Identifier): Boolean = Option(tables.remove(ident)).isDefined
+
+  override def renameTable(oldIdent: Identifier, newIdent: Identifier): Unit = {
+    if (tables.containsKey(newIdent)) {
+      throw new TableAlreadyExistsException(newIdent)
+    }
+
+    if (!oldIdent.namespace.sameElements(newIdent.namespace)) {
+      throw new UnsupportedOperationException("Table namespaces do not match: %s != %s"
 
 Review comment:
   Nit: It is more idiomatic in Scala to use string substitution:
   ```
   throw new UnsupportedOperationException(
       s"Table namespaces do not match: ${oldIdent.quoted} != ${newIdent.quoted}")
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org