[
https://issues.apache.org/jira/browse/DRILL-2002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14355266#comment-14355266
]
Sean Hsuan-Yi Chu commented on DRILL-2002:
------------------------------------------
Union-All on SELECT * (wildcard symbol) is supported only for the cases where
schema (i.e., hive, view) is available. If * is applied on schema-less data
source, exception will be thrown (see DRILL-2414).
For design specification document, please refer to DRILL-2207
> Confusing "star" behavior in UNION ALL operator
> -----------------------------------------------
>
> Key: DRILL-2002
> URL: https://issues.apache.org/jira/browse/DRILL-2002
> Project: Apache Drill
> Issue Type: Bug
> Components: Query Planning & Optimization
> Affects Versions: 0.8.0
> Reporter: Victoria Markman
> Assignee: Sean Hsuan-Yi Chu
> Fix For: 0.9.0
>
>
> t1.json
> {code}
> { "a1": 1 , "b1" : 1}
> { "a1": 2 , "b1" : 1}
> { "a1": 2 , "b1" : 2}
> { "a1": 3 , "b1" : 2}
> { "a1": null , "b1" : 3}
> {code}
> Star in both legs of UNION ALL works:
> {code}
> 0: jdbc:drill:schema=dfs> select * from `t1.json` union all select * from
> `t1.json`;
> +------------+------------+
> | a1 | b1 |
> +------------+------------+
> | 1 | 1 |
> | 2 | 1 |
> | 2 | 2 |
> | 3 | 2 |
> | null | 3 |
> | 1 | 1 |
> | 2 | 1 |
> | 2 | 2 |
> | 3 | 2 |
> | null | 3 |
> +------------+------------+
> 10 rows selected (0.126 seconds)
> {code}
> I expected this to work in structured, but it seems that since planner has no
> idea about meta data, error message seems reasonable:
> {code}
> 0: jdbc:drill:schema=dfs> select a1, b1 from `t1.json` union all select *
> from `t1.json`;
> Query failed: Query failed: Failure validating SQL.
> org.eigenbase.util.EigenbaseContextException: At line 1, column 47: Column
> count mismatch in UNION ALL
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> {code}
> Query below returns very confusing result. I expected it to error out like
> the query above:
> {code}
> 0: jdbc:drill:schema=dfs> select a1 from `t1.json` union all select * from
> `t1.json`;
> +------------+
> | a1 |
> +------------+
> | 1 |
> | 2 |
> | 2 |
> | 3 |
> | null |
> | 1 |
> | 2 |
> | 2 |
> | 3 |
> | null |
> +------------+
> 10 rows selected (0.111 seconds)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)