cloud-fan 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_r313207669
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2SessionCatalog.scala
 ##########
 @@ -153,6 +153,18 @@ class V2SessionCatalog(sessionState: SessionState) 
extends TableCatalog {
     }
   }
 
+  override def renameTable(oldIdent: Identifier, newIdent: Identifier): Unit = 
{
+    try {
+      if (Option(loadTable(newIdent)).isDefined) throw new 
TableAlreadyExistsException(newIdent)
 
 Review comment:
   I'd like to avoid using try catch as the control flow. How about
   ```
   if (tableExists(newIdent)) throw ...
   ```

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

Reply via email to