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 03:58:39 UTC

[jira] [Updated] (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:all-tabpanel ]

Deneche A. Hakim updated DRILL-4289:
------------------------------------
    Attachment: b1p1tbl.json

attached b1p1tbl json file

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