[ 
https://issues.apache.org/jira/browse/DRILL-3227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14566672#comment-14566672
 ] 

Rahul Challapalli commented on DRILL-3227:
------------------------------------------

The equivalent subqueries however yield the right results
{code}
0: jdbc:drill:schema=dfs_eea> select a.c1 from `a.json` a inner join (select 
t.c1 x, t.c2 y from `a.json` t) v1 on a.c1 = v1.y;
+-----+
| c1  |
+-----+
+-----+
No rows selected (0.205 seconds)
0: jdbc:drill:schema=dfs_eea> select a.c1 from `a.json` a inner join (select 
t.c1 x, t.c2 y from `a.json` t) v1 on a.c1 = v1.x;
+-----+
| c1  |
+-----+
| 1   |
+-----+
1 row selected (0.217 seconds)
{code}

> Planning Error : Self join between a view and underlying file fails to plan 
> when the view contains missing columns
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: DRILL-3227
>                 URL: https://issues.apache.org/jira/browse/DRILL-3227
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Query Planning & Optimization
>            Reporter: Rahul Challapalli
>            Assignee: Jinfeng Ni
>         Attachments: error.log
>
>
> git.commit.id.abbrev=6f54223
> The below view is created with non-existent columns
> {code}
> create or replace view v1(x,y) as select col1, col2 from `a.json`;
> +-------+-------------------------------------------------------------------+
> |  ok   |                              summary                              |
> +-------+-------------------------------------------------------------------+
> | true  | View 'v1' created successfully in 'dfs.drillTestDirViews' schema  |
> +-------+-------------------------------------------------------------------+
> 1 row selected (0.142 seconds)
> 0: jdbc:drill:schema=dfs_eea> select * from v1;
> +-------+-------+
> |   x   |   y   |
> +-------+-------+
> | null  | null  |
> +-------+-------+
> 1 row selected (0.129 seconds)
> {code}
> Now when I try to join the view with the underlying file, I get a planning 
> error
> {code}
> 0: jdbc:drill:schema=dfs_eea> select c1 from `a.json` a inner join v1 on a.c1 
> = v1.x;
> Error: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: 
> Unexpected exception during fragment initialization: null
> [Error Id: d38b4e61-d56f-4cd6-97dd-787deaebd33f on qa-node191.qa.lab:31010] 
> (state=,code=0)
> explain plan for select c1 from `a.json` a inner join v1 on a.c1 = v1.x;
> Error: SYSTEM ERROR: org.apache.drill.exec.work.foreman.ForemanException: 
> Unexpected exception during fragment initialization: null
> [Error Id: af10a933-ddf2-4bca-94a7-7b0383c9a1d4 on qa-node191.qa.lab:31010] 
> (state=,code=0)
> {code}
> I attached the data and the error log



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

Reply via email to