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

    https://github.com/apache/spark/pull/21655#discussion_r198750034
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
 ---
    @@ -1366,4 +1367,18 @@ class SessionCatalog(
         // copy over temporary views
         tempViews.foreach(kv => target.tempViews.put(kv._1, kv._2))
       }
    +
    +  private def validateLocationOfRename(oldName: TableIdentifier, newName: 
TableIdentifier): Unit = {
    +    val oldTable = getTableMetadata(oldName)
    +    if (oldTable.tableType == CatalogTableType.MANAGED) {
    +      val databaseLocation =
    +        
externalCatalog.getDatabase(oldName.database.getOrElse(currentDb)).locationUri
    +      val newTableLocation = new Path(new Path(databaseLocation), 
formatTableName(newName.table))
    +      val fs = newTableLocation.getFileSystem(hadoopConf)
    +      if (fs.exists(newTableLocation)) {
    +        throw new AnalysisException(s"Can not rename the managed 
table('${oldName}')" +
    --- End diff --
    
    nit: remove braces: `${oldName}` -> `$oldName`


---

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

Reply via email to