YannByron commented on a change in pull request #4587:
URL: https://github.com/apache/hudi/pull/4587#discussion_r783986627



##########
File path: 
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/AlterHoodieTableChangeColumnCommand.scala
##########
@@ -42,24 +42,27 @@ case class AlterHoodieTableChangeColumnCommand(
   extends HoodieLeafRunnableCommand {
 
   override def run(sparkSession: SparkSession): Seq[Row] = {
+    val resolver = sparkSession.sessionState.conf.resolver
     val hoodieCatalogTable = HoodieCatalogTable(sparkSession, tableIdentifier)
 
-    val resolver = sparkSession.sessionState.conf.resolver
-    if (!resolver(columnName, newColumn.name)) {
-      throw new AnalysisException(s"Can not support change column name for 
hudi table currently.")
-    }
+    // Find the origin column from dataSchema by column name.
+    val originColumn = findColumnByName(hoodieCatalogTable.dataSchema, 
columnName, resolver).getOrElse(
+      throw new AnalysisException(s"Can't find column `$columnName` given 
table data columns " +
+        s"${hoodieCatalogTable.dataSchema.fieldNames.mkString("[`", "`, `", 
"`]")}")
+    )
+

Review comment:
       This changes also do not support rename operation. See the 
`findColumnByName`'s implement.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to