eason-yuchen-liu commented on code in PR #59247:
URL: https://github.com/apache/spark/pull/59247#discussion_r4264028855
##########
sql/api/src/main/scala/org/apache/spark/sql/streaming/progress.scala:
##########
@@ -219,6 +220,12 @@ class StreamingQueryProgress private[spark] (
val observedMetrics: ju.Map[String, Row])
extends Serializable {
+ // JSON for the configured trigger, omitted for legacy progress records.
+ @JsonRawValue
+ @JsonInclude(JsonInclude.Include.NON_NULL)
+ @JsonDeserialize(using = classOf[ObjectToStringDeserializer])
+ private[spark] var trigger: String = _
Review Comment:
Can we make it a constructor variable of StreamingQueryProgress similar to
other fields?
##########
sql/api/src/main/scala/org/apache/spark/sql/execution/streaming/Triggers.scala:
##########
@@ -30,7 +30,19 @@ import org.apache.spark.sql.catalyst.util.SparkIntervalUtils
import org.apache.spark.sql.streaming.Trigger
import org.apache.spark.unsafe.types.UTF8String
-private object Triggers {
+private[spark] object Triggers {
+ def toJson(trigger: Trigger): String = trigger match {
+ case ProcessingTimeTrigger(intervalMs) =>
+ s"""{"type":"ProcessingTime","intervalMs":$intervalMs}"""
+ case ContinuousTrigger(intervalMs) =>
+ s"""{"type":"Continuous","intervalMs":$intervalMs}"""
+ case RealTimeTrigger(batchDurationMs) =>
+ s"""{"type":"RealTime","batchDurationMs":$batchDurationMs}"""
+ case AvailableNowTrigger => """{"type":"AvailableNow"}"""
+ case OneTimeTrigger => """{"type":"OneTime"}"""
+ case _ => null
Review Comment:
better to throw unreachable error
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]