You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2020/07/13 19:38:38 UTC
[GitHub] [calcite] amaliujia commented on a change in pull request #1981: [CALCITE-4000] Support OFFSET parameter in TUMBLE/HOP table functions…
amaliujia commented on a change in pull request #1981:
URL: https://github.com/apache/calcite/pull/1981#discussion_r453886468
##########
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
Review comment:
Done.
##########
File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
##########
@@ -3426,13 +3440,24 @@ abstract Expression implementSafe(RexToLixTranslator translator,
translatedOperands.add(slidingInterval);
translatedOperands.add(windowSize);
- return Expressions.call(BuiltInMethod.HOPPING.method,
+
+ // handle the optional offset parameter.
+ if (call.getOperands().size() > 3) {
+ translatedOperands.add(translator.translate(call.getOperands().get(3)));
+ } else {
+ // use 0 for the default value when offset parameter is missing.
Review comment:
+1
----------------------------------------------------------------
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:
users@infra.apache.org