Class TimeWindowUtil
java.lang.Object
org.apache.flink.table.runtime.util.TimeWindowUtil
Time util to deals window start and end in different timezone.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longgetNextTriggerWatermark(long currentWatermark, long interval, ZoneId shiftTimezone, boolean useDayLightSaving) Method to get the next watermark to trigger window.static ZoneIdgetShiftTimeZone(org.apache.flink.table.types.logical.LogicalType timeAttributeType, ZoneId zoneFromConfig) Get the shifted timezone of window if the time attribute type is TIMESTAMP_LTZ, always returns UTC timezone if the time attribute type is TIMESTAMP which means do not shift.static booleanisWindowFired(long windowEnd, long currentProgress, ZoneId shiftTimeZone) Returns the window should fired or not on current progress.static longtoEpochMills(long utcTimestampMills, ZoneId shiftTimeZone) Convert a timestamp mills with the given timezone to epoch mills.static longtoEpochMillsForTimer(long utcTimestampMills, ZoneId shiftTimeZone) Get a timer time according to the timestamp mills and the given shift timezone.static longtoUtcTimestampMills(long epochMills, ZoneId shiftTimeZone) Convert a epoch mills to timestamp mills which can describe a locate date time.
-
Constructor Details
-
TimeWindowUtil
public TimeWindowUtil()
-
-
Method Details
-
toUtcTimestampMills
Convert a epoch mills to timestamp mills which can describe a locate date time.For example: The timestamp string of epoch mills 5 in GMT+08:00 is 1970-01-01 08:00:05, the timestamp mills is 8 * 60 * 60 * 1000 + 5.
- Parameters:
epochMills- the epoch mills.shiftTimeZone- the timezone that the given timestamp mills has been shifted.- Returns:
- the mills which can describe the local timestamp string in given timezone.
-
toEpochMillsForTimer
Get a timer time according to the timestamp mills and the given shift timezone.- Parameters:
utcTimestampMills- the timestamp mills.shiftTimeZone- the timezone that the given timestamp mills has been shifted.- Returns:
- the epoch mills.
-
toEpochMills
Convert a timestamp mills with the given timezone to epoch mills.- Parameters:
utcTimestampMills- the timezone that the given timestamp mills has been shifted.shiftTimeZone- the timezone that the given timestamp mills has been shifted.- Returns:
- the epoch mills.
-
getShiftTimeZone
public static ZoneId getShiftTimeZone(org.apache.flink.table.types.logical.LogicalType timeAttributeType, ZoneId zoneFromConfig) Get the shifted timezone of window if the time attribute type is TIMESTAMP_LTZ, always returns UTC timezone if the time attribute type is TIMESTAMP which means do not shift. -
isWindowFired
Returns the window should fired or not on current progress.- Parameters:
windowEnd- the end of the time window.currentProgress- current progress of the window operator, it is processing time under proctime, it is watermark value under rowtime.shiftTimeZone- the shifted timezone of the time window.
-
getNextTriggerWatermark
public static long getNextTriggerWatermark(long currentWatermark, long interval, ZoneId shiftTimezone, boolean useDayLightSaving) Method to get the next watermark to trigger window.
-