[ 
https://issues.apache.org/jira/browse/DRILL-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Victoria Markman closed DRILL-3292.
-----------------------------------

> SUM(constant) OVER(...) returns wrong results
> ---------------------------------------------
>
>                 Key: DRILL-3292
>                 URL: https://issues.apache.org/jira/browse/DRILL-3292
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Relational Operators, Query Planning & 
> Optimization
>    Affects Versions: 1.0.0
>            Reporter: Deneche A. Hakim
>            Assignee: Sean Hsuan-Yi Chu
>            Priority: Critical
>              Labels: window_function
>             Fix For: 1.2.0
>
>         Attachments: DRILL-3291.1.patch
>
>
> The following query returns wrong results:
> {noformat}
> 0: jdbc:drill:> select sum(1) over w sum1, sum(5) over w sum5 from 
> cp.`employee.json` where position_id = 2 window w as (partition by 
> position_id);
> +-------+-------+
> | sum1  | sum5  |
> +-------+-------+
> | 6     | 6     |
> | 6     | 6     |
> | 6     | 6     |
> | 6     | 6     |
> | 6     | 6     |
> | 6     | 6     |
> +-------+-------+
> {noformat}
> The second column should display 30 (5 x 6) instead of 6.
> Here is the plan for the query:
> {noformat}
> 00-00    Screen
> 00-01      Project(sum1=[$0], sum5=[$1])
> 00-02        Project(sum1=[$0], sum5=[$1])
> 00-03          Project($0=[$1], $1=[$2])
> 00-04            Window(window#0=[window(partition {0} order by [] range 
> between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [SUM($1), SUM($2)])])
> 00-05              SelectionVectorRemover
> 00-06                Sort(sort0=[$0], dir0=[ASC])
> 00-07                  Filter(condition=[=($0, 2)])
> 00-08                    Scan(groupscan=[EasyGroupScan 
> [selectionRoot=/employee.json, numFiles=1, columns=[`position_id`], 
> files=[classpath:/employee.json]]])
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to