You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Sean Hsuan-Yi Chu (JIRA)" <ji...@apache.org> on 2015/07/01 22:04:04 UTC

[jira] [Commented] (DRILL-3292) SUM(constant) OVER(...) returns wrong results

    [ https://issues.apache.org/jira/browse/DRILL-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610919#comment-14610919 ] 

Sean Hsuan-Yi Chu commented on DRILL-3292:
------------------------------------------

Before hep planner. The plan is still reasonable. 
{code}
LogicalProject(SUM1=[SUM(1) OVER (PARTITION BY $0 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)], SUM5=[SUM(5) OVER (PARTITION BY $0 RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)])
  LogicalFilter(condition=[=($0, 2)])
    LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}

I am looking it right now


> 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
>
>
> 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)