Window#
Tumble Window#
Tumbling windows are consecutive, non-overlapping windows of a specified fixed length. For example, a tumbling window of 5 minutes size groups elements in 5 minutes intervals.
Example:
>>> from pyflink.table.expressions import col, lit
>>> Tumble.over(lit(10).minutes) \
... .on(col("rowtime")) \
... .alias("w")
|
Creates a tumbling window. |
|
Specifies the time attribute on which rows are grouped. |
|
Assigns an alias for this window that the following |
Sliding Window#
Sliding windows have a fixed size and slide by a specified slide interval. If the slide interval is smaller than the window size, sliding windows are overlapping. Thus, an element can be assigned to multiple windows.
For example, a sliding window of size 15 minutes with 5 minutes sliding interval groups elements of 15 minutes and evaluates every five minutes. Each element is contained in three consecutive window evaluations.
Example:
>>> from pyflink.table.expressions import col, lit
>>> Slide.over(lit(10).minutes) \
... .every(lit(5).minutes) \
... .on(col("rowtime")) \
... .alias("w")
|
Creates a sliding window. |
|
Specifies the window's slide as time or row-count interval. |
|
Specifies the time attribute on which rows are grouped. |
Assigns an alias for this window that the following |
Session Window#
The boundary of session windows are defined by intervals of inactivity, i.e., a session window is closes if no event appears for a defined gap period.
Example:
>>> from pyflink.table.expressions import col, lit
>>> Session.with_gap(lit(10).minutes) \\
... .on(col("rowtime")) \\
... .alias("w")
|
Creates a session window. |
|
Specifies the time attribute on which rows are grouped. |
|
Assigns an alias for this window that the following |
Over Window#
Similar to SQL, over window aggregates compute an aggregate for each input row over a range of its neighboring rows.
Example:
>>> from pyflink.table.expressions import col, UNBOUNDED_RANGE
>>> Over.partition_by(col("a")) \
... .order_by(col("rowtime")) \
... .preceding(UNBOUNDED_RANGE) \
... .alias("w")
|
Specifies the time attribute on which rows are ordered. |
|
Partitions the elements on some partition keys. |
Set the preceding offset (based on time or row-count intervals) for over window. |
|
|
Set the preceding offset (based on time or row-count intervals) for over window. |
Assigns an alias for this window that the following |
|
Set the following offset (based on time or row-count intervals) for over window. |
|
|
Specifies the time attribute on which rows are ordered. |