hequn8128 commented on a change in pull request #9248:
[FLINK-13446][table-runtime-blink] Fix assign logic for row count sliding window
URL: https://github.com/apache/flink/pull/9248#discussion_r308100033
##########
File path:
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/operators/window/assigners/CountSlidingWindowAssigner.java
##########
@@ -67,17 +67,19 @@ public void open(InternalWindowProcessFunction.Context<?,
CountWindow> ctx) thro
Long countValue = count.value();
long currentCount = countValue == null ? 0L : countValue;
count.update(currentCount + 1);
- long lastId = currentCount / windowSlide;
- long lastStart = lastId * windowSlide;
- long lastEnd = lastStart + windowSize - 1;
+ long windowId = currentCount / windowSlide;
+ long windowEnd = windowId * windowSlide + windowSlide - 1;
+ long windowStart = windowEnd - windowSize + 1;
List<CountWindow> windows = new ArrayList<>();
- while (lastId >= 0 && lastStart <= currentCount && currentCount
<= lastEnd) {
- if (lastStart <= currentCount && currentCount <=
lastEnd) {
- windows.add(new CountWindow(lastId));
+ while ((windowStart <= currentCount) && (currentCount <=
windowEnd)) {
+ if (0 > windowStart) {
+ windows.add(new CountWindow(windowId,
windowSize + windowStart));
+ } else {
+ windows.add(new CountWindow(windowId,
windowSize));
Review comment:
Good idea.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services