[
https://issues.apache.org/jira/browse/DRILL-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14804649#comment-14804649
]
Sean Hsuan-Yi Chu commented on DRILL-3238:
------------------------------------------
Filed a calcite issue here:
https://issues.apache.org/jira/browse/CALCITE-888
(Patch is available as pull request)
That parenthesis is used to do "window overlay" trick: For example, you can
have a query like:
{code}
select sum(c) over(w order by c)
from t
window w as (partition by c);
{code}
In the select list, {color:red} over(w order by c) {color} would be expanded to
{color:red} over(partition by c order by c) {color}
> Cannot Plan Exception is raised when the same window partition is defined in
> select & window clauses
> ----------------------------------------------------------------------------------------------------
>
> Key: DRILL-3238
> URL: https://issues.apache.org/jira/browse/DRILL-3238
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Reporter: Sean Hsuan-Yi Chu
> Assignee: Sean Hsuan-Yi Chu
> Priority: Critical
> Labels: window_function
> Fix For: 1.2.0
>
>
> While this works:
> {code}
> select sum(a2) over(partition by a2 order by a2), count(*) over(partition by
> a2 order by a2)
> from t
> {code}
> , this fails
> {code}
> select sum(a2) over(w), count(*) over(partition by a2 order by a2)
> from t
> window w as (partition by a2 order by a2)
> {code}
> Notice these two queries are logically the same thing if we plug-in the
> window definition back into the SELECT-CLAUSE in the 2nd query.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)