Zhang Xinyu created HIVE-3070:
---------------------------------

             Summary: outer join with filter over multiple tables on the same 
column have bug
                 Key: HIVE-3070
                 URL: https://issues.apache.org/jira/browse/HIVE-3070
             Project: Hive
          Issue Type: Bug
          Components: SQL
    Affects Versions: 0.8.1
            Reporter: Zhang Xinyu


should the result of query A: 

select s.aa, s.bb, c.key keyc from (select a.key aa, b.key bb from src a left 
outer join src b on a.key=b.key) s left outer join src c on s.bb=c.key and 
s.bb<10 where s.aa<20;

be the same as query B:

select a.key keya, b.key keyb, c.key keyc from src a left outer join src b on 
a.key=b.key left outer join src c on b.key=c.key and b.key<10 where a.key<20;

?

Currently, the result is different, query B gets wrong result!

In SemanticAnalyzer.java, mergeJoins():

ArrayList<ArrayList<ASTNode>> filters = target.getFilters();
for (int i = 0; i < nodeRightAliases.length; i++) {
  filters.add(node.getFilters().get(i + 1));
}

filters in node.getFilters().get(0) are lost.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to