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 2014/05/31 03:21:02 UTC

[jira] [Created] (DRILL-883) Wrong result when projecting certain columns if subquery and outer query have the same table

Aman Sinha created DRILL-883:
--------------------------------

             Summary: Wrong result when projecting certain columns if subquery and outer query have the same table 
                 Key: DRILL-883
                 URL: https://issues.apache.org/jira/browse/DRILL-883
             Project: Apache Drill
          Issue Type: Bug
            Reporter: Aman Sinha


In the following query, projecting n_regionkey in the outer query produces wrong results.  The outer query and subquery both reference nation table, although they should be separate instances.  Note that the Scan of nation in the outer query is project the wrong column (n_nationkey instead of n_regionkey).   That's causing the wrong results.   One other observation: disabling the push project into scan rule gives correct results.  

1 row selected (0.344 seconds)
0: jdbc:drill:zk=local> explain plan for select n1.n_regionkey from nation n1, (select n_nationkey from nation) as n2 where n1.n_nationkey = n2.n_nationkey;
+------------+------------+
|    text    |    json    |
+------------+------------+
| 00-00    Screen
00-01      UnionExchange
01-01        Project(n_regionkey=[$2])
01-02          HashJoin(condition=[=($1, $3)], joinType=[inner])
01-04            HashToRandomExchange(dist0=[[$1]])
02-01              Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=file:/Users/asinha/data/tpchmulti/nation]], selectionRoot=/Users/asinha/data/tpchmulti/nation, columns=[SchemaPath [`n_nationkey`]]]])
01-03            Project(n_nationkey0=[$0])
01-05              HashToRandomExchange(dist0=[[$0]])
03-01                Project(n_nationkey=[$1])
03-02                  Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=file:/Users/asinha/data/tpchmulti/nation]], selectionRoot=/Users/asinha/data/tpchmulti/nation, columns=[SchemaPath [`n_nationkey`]]]])

0: jdbc:drill:zk=local> select n1.n_regionkey from nation n1, (select n_nationkey from nation) as n2 where n1.n_nationkey = n2.n_nationkey;
+-------------+
| n_regionkey |
+-------------+
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
| null        |
+-------------+
25 rows selected (0.538 seconds)



--
This message was sent by Atlassian JIRA
(v6.2#6252)