Skip to content

Commit

Permalink
[MINOR] update alter rename command class type for pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightChess committed Apr 21, 2022
1 parent f7544e2 commit 62d2283
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ import org.apache.spark.sql.execution.command.AlterTableRenameCommand
/**
* Command for alter hudi table's table name.
*/
class AlterHoodieTableRenameCommand(
case class AlterHoodieTableRenameCommand(
oldName: TableIdentifier,
newName: TableIdentifier,
isView: Boolean)
extends AlterTableRenameCommand(oldName, newName, isView) {
extends HoodieLeafRunnableCommand {

override def run(sparkSession: SparkSession): Seq[Row] = {
if (newName != oldName) {
Expand All @@ -45,7 +45,7 @@ class AlterHoodieTableRenameCommand(
.initTable(hadoopConf, hoodieCatalogTable.tableLocation)

// Call AlterTableRenameCommand#run to rename table in meta.
super.run(sparkSession)
AlterTableRenameCommand(oldName, newName, isView).run(sparkSession)
}
Seq.empty[Row]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ case class HoodiePostAnalysisRule(sparkSession: SparkSession) extends Rule[Logic
// Rewrite the AlterTableRenameCommand to AlterHoodieTableRenameCommand
case AlterTableRenameCommand(oldName, newName, isView)
if !isView && sparkAdapter.isHoodieTable(oldName, sparkSession) =>
new AlterHoodieTableRenameCommand(oldName, newName, isView)
AlterHoodieTableRenameCommand(oldName, newName, isView)
// Rewrite the AlterTableChangeColumnCommand to AlterHoodieTableChangeColumnCommand
case AlterTableChangeColumnCommand(tableName, columnName, newColumn)
if sparkAdapter.isHoodieTable(tableName, sparkSession) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class HoodieCatalog extends DelegatingCatalogExtension
override def renameTable(oldIdent: Identifier, newIdent: Identifier): Unit = {
loadTable(oldIdent) match {
case _: HoodieInternalV2Table =>
new AlterHoodieTableRenameCommand(oldIdent.asTableIdentifier, newIdent.asTableIdentifier, false).run(spark)
AlterHoodieTableRenameCommand(oldIdent.asTableIdentifier, newIdent.asTableIdentifier, false).run(spark)
case _ => super.renameTable(oldIdent, newIdent)
}
}
Expand Down

0 comments on commit 62d2283

Please sign in to comment.