wenlong88 commented on a change in pull request #16207:
URL: https://github.com/apache/flink/pull/16207#discussion_r781697004
##########
File path:
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/triggers/ProcessingTimeTriggers.java
##########
@@ -59,28 +59,29 @@ private ProcessingTimeTriggers() {}
}
/**
- * Creates a trigger that fires by a certain interval after reception of
the first element.
+ * Creates a trigger that fires by a certain interval after reception of
the element. If no new
+ * element comes, it will not repeat itself.
*
* @param time the certain interval
*/
- public static <W extends Window> AfterFirstElementPeriodic<W>
every(Duration time) {
- return new AfterFirstElementPeriodic<>(time.toMillis());
+ public static <W extends Window> AfterElementNonPeriodic<W> every(Duration
time) {
+ return new AfterElementNonPeriodic<>(time.toMillis());
}
/**
- * Trigger every a given interval, the first trigger time is interval
after the first element in
- * the pane.
+ * Trigger fires by a certain interval after reception of the element. If
no new element comes,
+ * it will not repeat itself.
*
* @param <W> type of window
*/
- public static final class AfterFirstElementPeriodic<W extends Window>
extends WindowTrigger<W> {
+ public static final class AfterElementNonPeriodic<W extends Window>
extends WindowTrigger<W> {
Review comment:
maybe just name it: AfterFirstElement: Trigger fires in a given
interval when first element comes after last trigger.
##########
File path:
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/triggers/ProcessingTimeTriggers.java
##########
@@ -59,28 +59,29 @@ private ProcessingTimeTriggers() {}
}
/**
- * Creates a trigger that fires by a certain interval after reception of
the first element.
+ * Creates a trigger that fires by a certain interval after reception of
the element. If no new
+ * element comes, it will not repeat itself.
*
* @param time the certain interval
*/
- public static <W extends Window> AfterFirstElementPeriodic<W>
every(Duration time) {
- return new AfterFirstElementPeriodic<>(time.toMillis());
+ public static <W extends Window> AfterElementNonPeriodic<W> every(Duration
time) {
+ return new AfterElementNonPeriodic<>(time.toMillis());
}
/**
- * Trigger every a given interval, the first trigger time is interval
after the first element in
- * the pane.
+ * Trigger fires by a certain interval after reception of the element. If
no new element comes,
+ * it will not repeat itself.
*
* @param <W> type of window
*/
- public static final class AfterFirstElementPeriodic<W extends Window>
extends WindowTrigger<W> {
+ public static final class AfterElementNonPeriodic<W extends Window>
extends WindowTrigger<W> {
Review comment:
the toString of the trigger need to change too.
##########
File path:
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/triggers/ProcessingTimeTriggers.java
##########
@@ -59,28 +59,29 @@ private ProcessingTimeTriggers() {}
}
/**
- * Creates a trigger that fires by a certain interval after reception of
the first element.
+ * Creates a trigger that fires by a certain interval after reception of
the element. If no new
+ * element comes, it will not repeat itself.
*
* @param time the certain interval
*/
- public static <W extends Window> AfterFirstElementPeriodic<W>
every(Duration time) {
- return new AfterFirstElementPeriodic<>(time.toMillis());
+ public static <W extends Window> AfterElementNonPeriodic<W> every(Duration
time) {
+ return new AfterElementNonPeriodic<>(time.toMillis());
}
/**
- * Trigger every a given interval, the first trigger time is interval
after the first element in
- * the pane.
+ * Trigger fires by a certain interval after reception of the element. If
no new element comes,
+ * it will not repeat itself.
*
* @param <W> type of window
*/
- public static final class AfterFirstElementPeriodic<W extends Window>
extends WindowTrigger<W> {
+ public static final class AfterElementNonPeriodic<W extends Window>
extends WindowTrigger<W> {
Review comment:
I think the timer registered should not larger than end of window
##########
File path:
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/window/triggers/ProcessingTimeTriggers.java
##########
@@ -59,28 +59,29 @@ private ProcessingTimeTriggers() {}
}
/**
- * Creates a trigger that fires by a certain interval after reception of
the first element.
+ * Creates a trigger that fires by a certain interval after reception of
the element. If no new
+ * element comes, it will not repeat itself.
*
* @param time the certain interval
*/
- public static <W extends Window> AfterFirstElementPeriodic<W>
every(Duration time) {
- return new AfterFirstElementPeriodic<>(time.toMillis());
+ public static <W extends Window> AfterElementNonPeriodic<W> every(Duration
time) {
Review comment:
we should have a different name, maybe after(Duration delay)?
##########
File path:
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/utils/WindowEmitStrategy.scala
##########
@@ -17,6 +17,8 @@
*/
package org.apache.flink.table.planner.plan.utils
+import java.time.Duration
Review comment:
nit: code style
--
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]