You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Victoria Markman (JIRA)" <ji...@apache.org> on 2015/06/25 23:44:08 UTC

[jira] [Closed] (DRILL-3210) Star is not expanded correctly in projection list when used with window function

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

Victoria Markman closed DRILL-3210.
-----------------------------------

> Star is not expanded correctly in projection list when used with window function
> --------------------------------------------------------------------------------
>
>                 Key: DRILL-3210
>                 URL: https://issues.apache.org/jira/browse/DRILL-3210
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>    Affects Versions: 1.0.0
>            Reporter: Victoria Markman
>            Assignee: Jinfeng Ni
>              Labels: window_function
>             Fix For: 1.1.0
>
>         Attachments: 0001-DRILL-3210-Expand-star-column-properly-when-it-is-us.patch
>
>
> Just star ...
> {code}
> 0: jdbc:drill:schema=dfs> select * , sum(a1) over (partition by b1) from t1;
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> | T124¦¦a1  | T124¦¦b1  |  T124¦¦c1   |  a1   |   b1   | w0$o0  | w0$o1  | EXPR$1  | EXPR$10  |
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> | 1         | aaaaa     | 2015-01-01  | 1     | aaaaa  | 1      | 1      | 1       | 1        |
> | 2         | bbbbb     | 2015-01-02  | 2     | bbbbb  | 1      | 2      | 2       | 2        |
> | 3         | ccccc     | 2015-01-03  | 3     | ccccc  | 1      | 3      | 3       | 3        |
> | 5         | eeeee     | 2015-01-05  | 5     | eeeee  | 1      | 5      | 5       | 5        |
> | 6         | fffff     | 2015-01-06  | 6     | fffff  | 1      | 6      | 6       | 6        |
> | 7         | ggggg     | 2015-01-07  | 7     | ggggg  | 1      | 7      | 7       | 7        |
> | null      | hhhhh     | 2015-01-08  | null  | hhhhh  | 0      | 0      | null    | null     |
> | 9         | iiiii     | null        | 9     | iiiii  | 1      | 9      | 9       | 9        |
> | 10        | jjjjj     | 2015-01-10  | 10    | jjjjj  | 1      | 10     | 10      | 10       |
> | 4         | null      | 2015-01-04  | 4     | null   | 1      | 4      | 4       | 4        |
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> 10 rows selected (0.163 seconds)
> {code}
> t1 with the star ...
> {code}
> 0: jdbc:drill:schema=dfs> select t1.* , sum(a1) over (partition by b1) from t1;
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> | T125¦¦a1  | T125¦¦b1  |  T125¦¦c1   |  a1   |   b1   | w0$o0  | w0$o1  | EXPR$1  | EXPR$10  |
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> | 1         | aaaaa     | 2015-01-01  | 1     | aaaaa  | 1      | 1      | 1       | 1        |
> | 2         | bbbbb     | 2015-01-02  | 2     | bbbbb  | 1      | 2      | 2       | 2        |
> | 3         | ccccc     | 2015-01-03  | 3     | ccccc  | 1      | 3      | 3       | 3        |
> | 5         | eeeee     | 2015-01-05  | 5     | eeeee  | 1      | 5      | 5       | 5        |
> | 6         | fffff     | 2015-01-06  | 6     | fffff  | 1      | 6      | 6       | 6        |
> | 7         | ggggg     | 2015-01-07  | 7     | ggggg  | 1      | 7      | 7       | 7        |
> | null      | hhhhh     | 2015-01-08  | null  | hhhhh  | 0      | 0      | null    | null     |
> | 9         | iiiii     | null        | 9     | iiiii  | 1      | 9      | 9       | 9        |
> | 10        | jjjjj     | 2015-01-10  | 10    | jjjjj  | 1      | 10     | 10      | 10       |
> | 4         | null      | 2015-01-04  | 4     | null   | 1      | 4      | 4       | 4        |
> +-----------+-----------+-------------+-------+--------+--------+--------+---------+----------+
> 10 rows selected (0.158 seconds)
> {code}
> Explain plan:
> {code}
> 0: jdbc:drill:schema=dfs> explain plan for select * , sum(a1) over (partition by b1) from t1;
> +------+------+
> | text | json |
> +------+------+
> | 00-00    Screen
> 00-01      ProjectAllowDup(*=[$0], EXPR$1=[$1])
> 00-02        Project(*=[$0], EXPR$1=[CASE(>($3, 0), CAST($4):ANY, null)])
> 00-03          Window(window#0=[window(partition {2} order by [] range between UNBOUNDED PRECEDING and UNBOUNDED FOLLOWING aggs [COUNT($1), $SUM0($1)])])
> 00-04            SelectionVectorRemover
> 00-05              Sort(sort0=[$2], dir0=[ASC])
> 00-06                Project(T126¦¦*=[$0], a1=[$1], b1=[$2])
> 00-07                  Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=maprfs:///drill/testdata/subqueries/t1]], selectionRoot=/drill/testdata/subqueries/t1, numFiles=1, columns=[`*`]]])
> {code}
> Table schema:
> {code}
> 0: jdbc:drill:schema=dfs> select * from t1 limit 1;
> +-----+--------+-------------+
> | a1  |   b1   |     c1      |
> +-----+--------+-------------+
> | 1   | aaaaa  | 2015-01-01  |
> +-----+--------+-------------+
> 1 row selected (0.119 seconds)
> {code}



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