apache/rocketmq-streams

Why the termination condition is 'start > valueTime - sizeInterval' instead of 'start >= valueTime - sizeInterval' ?

starmilkxin opened this issue · 1 comments

    protected List<Window> calculateWindow(WindowInfo windowInfo, long valueTime) {
        long sizeInterval = windowInfo.getWindowSize().toMillSecond();
        long slideInterval = windowInfo.getWindowSlide().toMillSecond();

        List<Window> result = new ArrayList<>((int) (sizeInterval / slideInterval));
        long lastStart = valueTime - (valueTime + slideInterval) % slideInterval;

        for (long start = lastStart; start > valueTime - sizeInterval; start -= slideInterval) {
            long end = start + sizeInterval;
            Window window = new Window(start, end);
            result.add(window);
        }
        return result;
    }
ni-ze commented

if the expression is >=, the result of fellow is:
image

if the expression is >, the result of fellow is:
image

1970-01-01 08:00:40 must be in one window, so I think > is better.