[
https://issues.apache.org/jira/browse/DRILL-3297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14586764#comment-14586764
]
Jinfeng Ni commented on DRILL-3297:
-----------------------------------
Window functions rank(), dense_ranK() etc must have OVER clause() associated
with. This is different from aggregate function such as SUM / AVG etc, which
will simply become regular aggregate function, if no OVER clause() is
associated.
Therefore, this query is not valid. Postgres also returned error :
{code}
mydb=# select rank() from emp;
ERROR: window function call requires an OVER clause
LINE 1: select rank() from emp;
{code}
With that said, I agree we should modify planner to block such query.
Currently, the planer just treat rank() as regular aggregate function, which
leads to execution error, just as reported in this JIRA.
> Using rank, dense_rank, percent_rank, cume_dist, row_number window functions
> without OVER clause results in cryptic schema change error
> ---------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DRILL-3297
> URL: https://issues.apache.org/jira/browse/DRILL-3297
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Reporter: Victoria Markman
> Assignee: Jinfeng Ni
>
> {code}
> 0: jdbc:drill:schema=dfs> select rank() from t1;
> java.lang.RuntimeException: java.sql.SQLException: SYSTEM ERROR:
> org.apache.drill.exec.exception.SchemaChangeException: Failure while
> materializing expression.
> Error in expression at index -1. Error: Missing function implementation:
> [rank(BIGINT-REQUIRED)]. Full expression: --UNKNOWN EXPRESSION--.
> Fragment 0:0
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)