java.lang.Object
org.apache.flink.table.runtime.operators.window.Window
org.apache.flink.table.runtime.operators.window.TimeWindow
All Implemented Interfaces:
Comparable<Window>

public class TimeWindow extends Window
A Window that represents a time interval from start (inclusive) to end (exclusive).
  • Constructor Details

    • TimeWindow

      public TimeWindow(long start, long end)
  • Method Details

    • getStart

      public long getStart()
      Gets the starting timestamp of the window. This is the first timestamp that belongs to this window.
      Returns:
      The starting timestamp of this window.
    • getEnd

      public long getEnd()
      Gets the end timestamp of this window. The end timestamp is exclusive, meaning it is the first timestamp that does not belong to this window any more.
      Returns:
      The exclusive end timestamp of this window.
    • maxTimestamp

      public long maxTimestamp()
      Gets the largest timestamp that still belongs to this window.

      This timestamp is identical to getEnd() - 1.

      Specified by:
      maxTimestamp in class Window
      Returns:
      The largest timestamp that still belongs to this window.
      See Also:
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in class Window
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class Window
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • intersects

      public boolean intersects(TimeWindow other)
      Returns true if this window intersects the given window.
    • cover

      public TimeWindow cover(TimeWindow other)
      Returns the minimal window covers both this window and the given window.
    • compareTo

      public int compareTo(Window o)
    • getWindowStartWithOffset

      public static long getWindowStartWithOffset(long timestamp, long offset, long windowSize)
      Method to get the window start for a timestamp.
      Parameters:
      timestamp - epoch millisecond to get the window start.
      offset - The offset which window start would be shifted by.
      windowSize - The size of the generated windows.
      Returns:
      window start
    • of

      public static TimeWindow of(long start, long end)