You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zhang Xinyu (JIRA)" <ji...@apache.org> on 2012/05/31 11:46:25 UTC

[jira] [Created] (HIVE-3070) outer join with filter over multiple tables on the same column have bug

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

        

[jira] [Updated] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Navis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Navis updated HIVE-3070:
------------------------

    Status: Patch Available  (was: Open)

https://reviews.facebook.net/D4239
                
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.9.0, 0.8.1, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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

        

[jira] [Updated] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Navis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Navis updated HIVE-3070:
------------------------

    Affects Version/s: 0.10.0
                       0.9.0
             Assignee: Navis
              Summary: Filter on outer join condition removed while merging join tree  (was: outer join with filter over multiple tables on the same column have bug)
    
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.8.1, 0.9.0, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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

        

[jira] [Commented] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Navis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13419055#comment-13419055 ] 

Navis commented on HIVE-3070:
-----------------------------

Zhang Xinyu have fixed most of it. I just made a patch.
                
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.8.1, 0.9.0, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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

        

[jira] [Commented] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Namit Jain (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13419051#comment-13419051 ] 

Namit Jain commented on HIVE-3070:
----------------------------------

+1

nice catch
                
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.8.1, 0.9.0, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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

        

[jira] [Updated] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Namit Jain (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Namit Jain updated HIVE-3070:
-----------------------------

      Resolution: Fixed
    Hadoop Flags: Reviewed
          Status: Resolved  (was: Patch Available)

Committed. Thanks Navais and Zhang
                
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.8.1, 0.9.0, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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

        

[jira] [Commented] (HIVE-3070) Filter on outer join condition removed while merging join tree

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HIVE-3070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13419781#comment-13419781 ] 

Hudson commented on HIVE-3070:
------------------------------

Integrated in Hive-trunk-h0.21 #1557 (See [https://builds.apache.org/job/Hive-trunk-h0.21/1557/])
    HIVE-3070 Filter on outer join condition removed while merging join tree
(Navis via namit) (Revision 1364037)

     Result = FAILURE
namit : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1364037
Files : 
* /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
* /hive/trunk/ql/src/test/queries/clientpositive/mergejoins.q
* /hive/trunk/ql/src/test/results/clientpositive/mergejoins.q.out

                
> Filter on outer join condition removed while merging join tree
> --------------------------------------------------------------
>
>                 Key: HIVE-3070
>                 URL: https://issues.apache.org/jira/browse/HIVE-3070
>             Project: Hive
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 0.8.1, 0.9.0, 0.10.0
>            Reporter: Zhang Xinyu
>            Assignee: Navis
>
> 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