[
https://issues.apache.org/jira/browse/DRILL-3377?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jinfeng Ni reassigned DRILL-3377:
---------------------------------
Assignee: Jinfeng Ni (was: Venki Korukanti)
> Can't partition by expression when columns are explicitly specified in the
> CTAS column list
> -------------------------------------------------------------------------------------------
>
> Key: DRILL-3377
> URL: https://issues.apache.org/jira/browse/DRILL-3377
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Affects Versions: 1.0.0
> Reporter: Victoria Markman
> Assignee: Jinfeng Ni
> Labels: ctas
> Attachments:
> 0001-DRILL-3377-Fix-naming-resolution-error-for-partition.patch
>
>
> Query below throws an error:
> {code:sql}
> create table test(x1, x2) partition by (x1) as
> select sum(a1), b1
> from t1
> group by b1;
> {code}
> {code}
> 0: jdbc:drill:schema=dfs> create table test(x1, x2) partition by (x1) as
> select sum(a1), b1 from t1 group by b1;
> Error: SYSTEM ERROR: IllegalArgumentException: partition col x1 could not be
> resolved in table's column lists!
> [Error Id: ab5624e8-e4dd-4752-95af-8bc2eef5d056 on atsqa4-133.qa.lab:31010]
> (state=,code=0)
> {code}
> When column aliases are used, it works:
> {code}
> 0: jdbc:drill:schema=dfs> create table test partition by (x1) as select
> sum(a1) x1, b1 x2 from t1 group by b1;
> +-----------+----------------------------+
> | Fragment | Number of records written |
> +-----------+----------------------------+
> | 0_0 | 10 |
> +-----------+----------------------------+
> 1 row selected (0.904 seconds)
> 0: jdbc:drill:schema=dfs> select * from test;
> +-------+--------+
> | x1 | x2 |
> +-------+--------+
> | null | hhhhh |
> | 2 | bbbbb |
> | 10 | jjjjj |
> | 1 | aaaaa |
> | 3 | ccccc |
> | 4 | null |
> | 5 | eeeee |
> | 7 | ggggg |
> | 6 | fffff |
> | 9 | iiiii |
> +-------+--------+
> 10 rows selected (0.161 seconds)
> 0: jdbc:drill:schema=dfs> select * from test order by x1;
> +-------+--------+
> | x1 | x2 |
> +-------+--------+
> | 1 | aaaaa |
> | 2 | bbbbb |
> | 3 | ccccc |
> | 4 | null |
> | 5 | eeeee |
> | 6 | fffff |
> | 7 | ggggg |
> | 9 | iiiii |
> | 10 | jjjjj |
> | null | hhhhh |
> +-------+--------+
> 10 rows selected (0.299 seconds)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)