You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Deneche A. Hakim (JIRA)" <ji...@apache.org> on 2016/01/20 04:00:44 UTC
[jira] [Commented] (DRILL-4289) window functions give different
results if star is used in inner query
[ https://issues.apache.org/jira/browse/DRILL-4289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15107885#comment-15107885 ]
Deneche A. Hakim commented on DRILL-4289:
-----------------------------------------
Here is the plan for the 1st query:
{noformat}
00-00 Screen
00-01 Project(position_id=[$0], count=[$1])
00-02 Project(position_id=[$0], count=[$1])
00-03 Window(window#0=[window(partition {0} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [COUNT()])])
00-04 SelectionVectorRemover
00-05 Sort(sort0=[$0], dir0=[ASC])
00-06 Project(position_id=[$0])
00-07 SelectionVectorRemover
00-08 Sort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[ASC])
00-09 Project(position_id=[$1], employee_id=[$0], sub=[$2])
00-10 Scan(groupscan=[EasyGroupScan [selectionRoot=file:/Users/hakim/MapR/data/windowData/b1.p2, numFiles=1, columns=[`position_id`, `employee_id`, `sub`], files=[file:/Users/hakim/MapR/data/windowData/b1.p2/0.data.json]]])
{noformat}
and the one for the 2nd query:
{noformat}
00-00 Screen
00-01 ProjectAllowDup(position_id=[$0], count=[$1])
00-02 Project($1=[$1], w0$o0=[$2])
00-03 Window(window#0=[window(partition {0} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [COUNT()])])
00-04 SelectionVectorRemover
00-05 Sort(sort0=[$0], dir0=[ASC])
00-06 Project(T9¦¦*=[$0], $1=[ITEM($0, 'position_id')])
00-07 SelectionVectorRemover
00-08 Sort(sort0=[$1], sort1=[$2], dir0=[ASC], dir1=[ASC])
00-09 Project(T9¦¦*=[$0], employee_id=[$1], sub=[$2])
00-10 Scan(groupscan=[EasyGroupScan [selectionRoot=file:/Users/hakim/MapR/data/windowData/b1.p2, numFiles=1, columns=[`*`], files=[file:/Users/hakim/MapR/data/windowData/b1.p2/0.data.json]]])
{noformat}
> window functions give different results if star is used in inner query
> ----------------------------------------------------------------------
>
> Key: DRILL-4289
> URL: https://issues.apache.org/jira/browse/DRILL-4289
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Affects Versions: 1.5.0
> Reporter: Deneche A. Hakim
> Attachments: b1p1tbl.json
>
>
> The following queries give different results, although they are similar:
> {noformat}
> SELECT position_id, COUNT(*) OVER w AS `count` FROM (SELECT position_id FROM `/b1p2tbl` ORDER BY employee_id, sub) WINDOW w AS (PARTITION BY position_id);
> +--------------+--------+
> | position_id | count |
> +--------------+--------+
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 1 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> | 2 | 10 |
> +--------------+--------+
> {noformat}
> {noformat}
> SELECT position_id, COUNT(*) OVER w AS `count` FROM (SELECT * FROM dfs.data.`b1p2tbl` ORDER BY employee_id, sub) WINDOW w AS (PARTITION BY position_id);
> +--------------+--------+
> | position_id | count |
> +--------------+--------+
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 1 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> | 2 | 20 |
> +--------------+--------+
> {noformat}
> the results of the second query are incorrect.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)