xiarixiaoyao commented on a change in pull request #4535:
URL: https://github.com/apache/hudi/pull/4535#discussion_r810608444



##########
File path: 
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala
##########
@@ -133,26 +136,65 @@ case class HoodieAnalysis(sparkSession: SparkSession) 
extends Rule[LogicalPlan]
       // Convert to CompactionShowHoodiePathCommand
       case CompactionShowOnPath(path, limit) =>
         CompactionShowHoodiePathCommand(path, limit)
-      case _=> plan
+      // Convert to HoodieCallProcedureCommand
+      case CallCommand(name, args) =>
+        val procedure: Option[Procedure] = loadProcedure(name)
+        val input = buildProcedureArgs(args)
+        CallProcedureHoodieCommand(procedure.get, input)
+      case _ => plan
+    }
+  }
+
+  private def loadProcedure(name: Seq[String]): Option[Procedure] = {
+    val procedure: Option[Procedure] = if (name.nonEmpty) {
+      val builder = HoodieProcedures.newBuilder(name.last)
+      if (builder != null) {
+        Option.apply(builder.build)
+      } else {
+        throw new AnalysisException(s"procedure: ${name.last} is not exists")
+      }
+    } else {
+      Option.empty

Review comment:
       None




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