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

    https://github.com/apache/spark/pull/12121#discussion_r58285705
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
    @@ -195,67 +195,133 @@ case class DropFunction(
         isTemp: Boolean)(sql: String)
       extends NativeDDLCommand(sql) with Logging
     
    -/** Rename in ALTER TABLE/VIEW: change the name of a table/view to a 
different name. */
    +/**
    + * A command that renames a table/view.
    + *
    + * The syntax of this command is:
    + * {{{
    + *    ALTER TABLE table1 RENAME TO table2;
    + *    ALTER VIEW view1 RENAME TO view2;
    + * }}}
    + */
     case class AlterTableRename(
         oldName: TableIdentifier,
    -    newName: TableIdentifier)(sql: String)
    -  extends NativeDDLCommand(sql) with Logging
    +    newName: TableIdentifier)
    +  extends RunnableCommand {
    +
    +  override def run(sqlContext: SQLContext): Seq[Row] = {
    +    sqlContext.sessionState.catalog.renameTable(oldName, newName)
    +    Seq.empty[Row]
    --- End diff --
    
    Here, based on my understanding, two extra steps are needed for table 
rename. 
    
    First, in `HiveSessionCatalog`, the function `renameTable` needs to 
invalidate the Hive Megastore Cache by 
`hiveContext.invalidateTable(tableName)`. 
    
    Second, here, we need an efficient way to refresh `CacheManager`. 
    
    Please correct me if I am wrong. Thanks!


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to