drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aman Sinha (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-883) Wrong result when projecting certain columns if subquery and outer query have the same table
Date Sat, 31 May 2014 01:21:02 GMT
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)

Mime
View raw message