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/08/12 02:59:46 UTC

[jira] [Commented] (DRILL-3580) wrong plan for window function queries containing function(col1 + colb)

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

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

A similar issue can be reproduced in Calcite here:
https://issues.apache.org/jira/browse/CALCITE-841

> wrong plan for window function queries containing function(col1 + colb)
> -----------------------------------------------------------------------
>
>                 Key: DRILL-3580
>                 URL: https://issues.apache.org/jira/browse/DRILL-3580
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.1.0
>            Reporter: Deneche A. Hakim
>            Assignee: Sean Hsuan-Yi Chu
>            Priority: Critical
>              Labels: window_function
>             Fix For: 1.2.0
>
>
> The following query has a wrong plan:
> {noformat}
> explain plan for select position_id, salary, sum(salary) over (partition by position_id), sum(position_id + salary) over (partition by position_id) from cp.`employee.json` limit 20;
> +------+------+
> | text | json |
> +------+------+
> | 00-00    Screen
> 00-01      ProjectAllowDup(position_id=[$0], salary=[$1], EXPR$2=[$2], EXPR$3=[$3])
> 00-02        SelectionVectorRemover
> 00-03          Limit(fetch=[20])
> 00-04            Project(position_id=[$0], salary=[$1], w0$o0=[$2], w0$o00=[$4])
> 00-05              Window(window#0=[window(partition {0} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [SUM($3)])])
> 00-06                Project(position_id=[$1], salary=[$2], w0$o0=[$3], $3=[+($1, $2)])
> 00-07                  Window(window#0=[window(partition {1} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [SUM($2)])])
> 00-08                    SelectionVectorRemover
> 00-09                      Sort(sort0=[$1], dir0=[ASC])
> 00-10                        Project(T13¦¦*=[$0], position_id=[$1], salary=[$2])
> 00-11                          Scan(groupscan=[EasyGroupScan [selectionRoot=classpath:/employee.json, numFiles=1, columns=[`*`], files=[classpath:/employee.json]]])
> {noformat}
> The plan contains 2 window operators which shouldn't be possible according to DRILL-3196. 
> The results are also incorrect.
> Depending on which aggregation or window function used we get wrong results or an IndexOutOfBounds exception



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