Victoria Markman created DRILL-2002:
---------------------------------------

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

Reply via email to