Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/454#discussion_r28583531
--- Diff: tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
---
@@ -726,47 +747,125 @@ public EvalNode visitWindowFunction(Context ctx,
Stack<Expr> stack, WindowFuncti
paramTypes[i] = givenArgs[i].getValueType();
}
} else {
- if (windowFunc.getSignature().equalsIgnoreCase("rank")) {
+ if (funcName.equalsIgnoreCase("rank")) {
givenArgs = sortKeys != null ? sortKeys : new EvalNode[0];
}
}
+ // When no window frame is declared in the query, use default value
+ // default window frame is RANGE BETWEEN UNBOUNDED PRECEDING AND
CURRENT ROW
if (frame == null) {
- if (windowSpec.hasOrderBy()) {
- frame = new WindowFrame(new
WindowStartBound(WindowFrameStartBoundType.UNBOUNDED_PRECEDING),
- new WindowEndBound(WindowFrameEndBoundType.CURRENT_ROW));
- } else if (windowFunc.getSignature().equalsIgnoreCase("row_number"))
{
- frame = new WindowFrame(new
WindowStartBound(WindowFrameStartBoundType.UNBOUNDED_PRECEDING),
- new
WindowEndBound(WindowFrameEndBoundType.UNBOUNDED_FOLLOWING));
+ frame = new LogicalWindowFrame(WindowFrameUnit.RANGE, new
LogicalWindowBound(WindowFrameBoundType.UNBOUNDED_PRECEDING),
+ new LogicalWindowBound(WindowFrameBoundType.CURRENT_ROW));
+ }
+
+ // set Function Type to determine whether window frame is applied or
not
+ // NONFRAMABLE: builtin window function that works on entire
partition
+ // FRAMABLE: builtin window function that works on window frame
+ // AGGREGATION: aggregation functions that work on window frame
--- End diff --
How about moving these comments to the code where the enum is defined?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---