Github user sirpkt commented on a diff in the pull request:
https://github.com/apache/tajo/pull/454#discussion_r28211475
--- Diff: tajo-plan/src/main/java/org/apache/tajo/plan/ExprAnnotator.java
---
@@ -678,8 +679,26 @@ public EvalNode visitGeneralSetFunction(Context ctx,
Stack<Expr> stack, GeneralS
}
}
+
public static final Set<String> WINDOW_FUNCTIONS =
- Sets.newHashSet("row_number", "rank", "dense_rank", "percent_rank",
"cume_dist", "first_value", "lag");
+ Sets.newHashSet("row_number", "rank", "dense_rank", "percent_rank",
"cume_dist", "ntile", "first_value", "last_value", "lag");
+
+ public static final Set<String> NONFRAMABLE_WINDOW_FUNCTIONS =
+ Sets.newHashSet("row_number", "rank", "dense_rank", "percent_rank",
"cume_dist", "ntile", "lag", "lead");
+ public static final Set<String> FRAMABLE_WINDOW_FUNCTIONS =
+ Sets.newHashSet("first_value", "last_value", "nth_value");
+
+ public static FunctionType getFunctionType(String functionName, boolean
distinct) {
+// if
(NONFRAMABLE_WINDOW_FUNCTIONS.contains(functionName.toLowerCase()) ||
FRAMABLE_WINDOW_FUNCTIONS.contains(functionName.toLowerCase())) {
+ if (WINDOW_FUNCTIONS.contains(functionName.toLowerCase())) {
+ if (distinct && functionName.equalsIgnoreCase("row_number")) {
+ throw new NoSuchFunctionException("row_number() does not support
distinct keyword.");
--- End diff --
I just made a function wrapper for the code and did not change the code
itself,
however, I think ```distinct``` should be allowed with ```row_number()```
as we can use ```distinct row_number()``` in other DBMSs.
I'll check further about that.
---
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.
---