danny0405 commented on a change in pull request #1981:
URL: https://github.com/apache/calcite/pull/1981#discussion_r454929221



##########
File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
##########
@@ -786,28 +787,29 @@ static Expression tumblingWindowSelector(
     final Expression wmColExprToLong = EnumUtils.convert(wmColExpr, 
long.class);
     final Expression shiftExpr = Expressions.constant(1, long.class);
 
-    // Find the fixed window for a timestamp given a window size and return 
the window start.
-    // Fixed windows counts from timestamp 0.
-    // wmMillis / intervalMillis * intervalMillis
-    expressions.add(
-        Expressions.multiply(
-            Expressions.divide(
+    // Find the fixed window for a timestamp given a window size and an 
offset, and return the
+    // window start.
+    // wmMillis - (wmColExprToLong + windowSizeMillis - offsetMillis) % 
windowSizeMillis
+    Expression windowStartExpr = Expressions.subtract(

Review comment:
       `wmMillis ` -> `wmColExprToLong `




----------------------------------------------------------------
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]


Reply via email to