Sean Hsuan-Yi Chu created DRILL-2830:
----------------------------------------

             Summary: Self-Join via view gives wrong results
                 Key: DRILL-2830
                 URL: https://issues.apache.org/jira/browse/DRILL-2830
             Project: Apache Drill
          Issue Type: Bug
          Components: Query Planning & Optimization
            Reporter: Sean Hsuan-Yi Chu
            Assignee: Sean Hsuan-Yi Chu
            Priority: Critical


Create a view by:
{code}
create view v1(x, y) as select n_regionkey,  n_nationkey from 
cp.`tpch/nation.parquet`;
{code}

And join this view with the file which created the view with condition 
t.n_nationkey  = v1.y (where 'y' is n_nationkey)

{code}
select t.n_nationkey from cp.`tpch/nation.parquet` t inner join v1 on 
t.n_nationkey  = v1.y;
{code}

+-------------+
| n_nationkey |
+-------------+
| 0           |
| 1           |
| 1           |
| 1           |
| 4           |
| 0           |
| 3           |
| 3           |
| 2           |
| 2           |
| 4           |
| 4           |
| 2           |
| 4           |
| 0           |
| 0           |
| 0           |
| 1           |
| 2           |
| 3           |
| 4           |
| 2           |
| 3           |
| 3           |
| 1           |
+-------------+
25 rows selected (0.153 seconds)

After investigating the plan, I found out that the result was produced as if 
the join condition was t.n_nationkey  = v1.x (where x is 'n_regionkey')



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

Reply via email to