You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Aman Sinha (JIRA)" <ji...@apache.org> on 2015/01/13 22:26:35 UTC
[jira] [Commented] (DRILL-2002) Confusing "star" behavior in UNION
ALL operator
[ https://issues.apache.org/jira/browse/DRILL-2002?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14275969#comment-14275969 ]
Aman Sinha commented on DRILL-2002:
-----------------------------------
Agree that this should fail in some way - either during planning or during execution. I think we should not allow doing a union all of regular column with star column in drill due to the schema-less nature. During the planning process, '*' is treated as a single column and doing a union with single column passes validation. It should have failed during execution once '*' expands to more than 1 column but the union-all operator does not do this type of check. I will take a look ...
> 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: Jinfeng Ni
>
> 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)