voonhous commented on code in PR #9068:
URL: https://github.com/apache/hudi/pull/9068#discussion_r1261388037


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/HoodieProcedureUtils.scala:
##########
@@ -43,4 +47,79 @@ object HoodieProcedureUtils {
 
     ProcedureArgs(isNamedArgs = true, map, new GenericInternalRow(values))
   }
+
+  sealed trait Operation {
+    def value: String
+
+    def isSchedule: Boolean
+
+    def isExecute: Boolean
+  }
+
+  /**
+   * schedule: schedule a new plan
+   */
+  case object Schedule extends Operation {
+    override def value: String = "schedule"
+
+    override def isSchedule: Boolean = true
+
+    override def isExecute: Boolean = false
+  }
+
+  /**
+   * execute: if specific instants exist, execute them, otherwise execute all 
pending plans
+   */
+  case object Execute extends Operation {
+    override def value: String = "execute"
+
+    override def isSchedule: Boolean = false
+
+    override def isExecute: Boolean = true
+  }
+
+  /**
+   * scheduleAndExecute: schedule a new plan and then execute it, if no plan 
is generated during
+   * schedule, execute all pending plans
+   */
+  case object ScheduleAndExecute extends Operation {
+    override def value: String = "scheduleandexecute"
+
+    override def isSchedule: Boolean = true
+
+    override def isExecute: Boolean = true
+  }
+
+  object Operation {
+    private val ValueToEnumMap: Map[String, Operation with Product with 
Serializable] = Seq(Schedule, Execute, ScheduleAndExecute)
+      .map(enum => enum.value -> enum).toMap
+
+    def fromValue(value: String): Operation = {
+      ValueToEnumMap.getOrElse(value, throw new HoodieException(s"Invalid 
value ($value)"))
+    }
+  }
+
+  def fileterPendingInstantsAndGetOperation(pendingInstants: Seq[String], 
specificInstants: Option[String], op: Option[String]): (Seq[String], Operation) 
= {

Review Comment:
   Typo



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