数据划分窗口
package org.apache.flink.streaming.api.windowing.windows;
/**
* A {@link Window} that represents a time interval from {@code start} (inclusive) to {@code end}
* (exclusive).
*/
@PublicEvolving
public class TimeWindow extends Window {
/**
* Method to get the window start for a timestamp.
*
* @param timestamp epoch millisecond to get the window start.
* @param offset The offset which window start would be shifted by.
* @param windowSize The size of the generated windows.
* @return window start
*/
public static long getWindowStartWithOffset(long timestamp, long offset, long windowSize) {
return timestamp - (timestamp - offset + windowSize) % windowSize;
}
}
数据划分到窗口时,窗口是左闭右开的,相关代码在上面的类中