HeartSaVioR commented on code in PR #45960:
URL: https://github.com/apache/spark/pull/45960#discussion_r1560508262
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/TimerStateImpl.scala:
##########
@@ -23,14 +23,15 @@ import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.execution.streaming.state._
-import org.apache.spark.sql.streaming.TimeoutMode
+import org.apache.spark.sql.streaming.TimeMode
import org.apache.spark.sql.types._
import org.apache.spark.util.NextIterator
/**
* Singleton utils class used primarily while interacting with TimerState
*/
object TimerStateUtils {
+ // TODO(sahnib): remove this if not needed
Review Comment:
nit: Just to make sure, do you intend to leave this TODO after merging this
PR, or is it expected to be handled in this PR?
##########
sql/api/src/main/java/org/apache/spark/sql/streaming/TimeMode.java:
##########
@@ -19,24 +19,32 @@
import org.apache.spark.annotation.Evolving;
import org.apache.spark.annotation.Experimental;
-import org.apache.spark.sql.catalyst.plans.logical.*;
+import org.apache.spark.sql.catalyst.plans.logical.EventTime$;
+import org.apache.spark.sql.catalyst.plans.logical.NoTime$;
+import org.apache.spark.sql.catalyst.plans.logical.ProcessingTime$;
/**
- * Represents the type of ttl modes possible for the Dataset operations
- * {@code transformWithState}.
+ * Represents the time modes (used for specifying timers and ttl) possible for
+ * the Dataset operations {@code transformWithState}.
*/
@Experimental
@Evolving
-public class TTLMode {
+public class TimeMode {
- /**
- * Specifies that there is no TTL for the user state. User state would not
- * be cleaned up by Spark automatically.
- */
- public static final TTLMode NoTTL() { return NoTTL$.MODULE$; }
+ /**
+ * Stateful processor that does not register timers, or use ttl eviction.
Review Comment:
nit: neither ~ nor would help reducing confusion.
##########
sql/api/src/main/java/org/apache/spark/sql/streaming/TimeMode.java:
##########
@@ -19,24 +19,32 @@
import org.apache.spark.annotation.Evolving;
import org.apache.spark.annotation.Experimental;
-import org.apache.spark.sql.catalyst.plans.logical.*;
+import org.apache.spark.sql.catalyst.plans.logical.EventTime$;
+import org.apache.spark.sql.catalyst.plans.logical.NoTime$;
+import org.apache.spark.sql.catalyst.plans.logical.ProcessingTime$;
/**
- * Represents the type of ttl modes possible for the Dataset operations
- * {@code transformWithState}.
+ * Represents the time modes (used for specifying timers and ttl) possible for
+ * the Dataset operations {@code transformWithState}.
*/
@Experimental
@Evolving
-public class TTLMode {
+public class TimeMode {
- /**
- * Specifies that there is no TTL for the user state. User state would not
- * be cleaned up by Spark automatically.
- */
- public static final TTLMode NoTTL() { return NoTTL$.MODULE$; }
+ /**
+ * Stateful processor that does not register timers, or use ttl eviction.
+ */
+ public static final TimeMode None() { return NoTime$.MODULE$; }
- /**
- * Specifies that all ttl durations for user state are in processing time.
- */
- public static final TTLMode ProcessingTimeTTL() { return
ProcessingTimeTTL$.MODULE$; }
+ /**
+ * Stateful processor that uses query processing time to register timers or
Review Comment:
nit: Are we allowing both timer and TTL? Then let's be explicit via `and/or`.
--
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]