You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "yuebing.fu (JIRA)" <ji...@apache.org> on 2014/12/10 09:31:12 UTC

[jira] [Created] (HIVE-9065) Multiple join Predicate Push Down error

yuebing.fu created HIVE-9065:
--------------------------------

             Summary: Multiple join Predicate Push Down error
                 Key: HIVE-9065
                 URL: https://issues.apache.org/jira/browse/HIVE-9065
             Project: Hive
          Issue Type: Bug
          Components: SQL
    Affects Versions: 0.13.0
         Environment: hadoop2.5  jdk1.7
            Reporter: yuebing.fu
             Fix For: 0.13.0


Example sql
SELECT count(*)
    FROM
    tmp.ls_cardlastsetl_tmp a 
    INNER JOIN tmp.ls_distinct_nbkentrycard b ON a.cardid=b.cswcardid 
    INNER JOIN default.s_tbl_bank d ON b.bankid=d.id 
    INNER JOIN tmp.ls_cardlastmod_tmp e ON b.cswcardid=e.cardid
WHERE to_date(b.cardcreatetime)<"2014-11-20" AND to_date(from_unixtime(e.lastmodtime))>"2014-11-30" ;

plan:
FS
   SEL
      GBY
         RS
            GBY
               SEL
                     JOIN
                        RS
                           JOIN
                              RS
                                 TS[a]
                              RS
                                 FIL
                                    TS[b]
                              RS
                                 TS[e]
                        RS
                           TS[d]
Table e of FIL be lost
Reason:
When e into a, b, leftAlias not updated
Fix patch:
 
Index: /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/QBJoinTree.java
===================================================================
--- /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/QBJoinTree.java	(revision 85984)
+++ /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/QBJoinTree.java	(working copy)
@@ -363,4 +363,22 @@
   public List<ASTNode> getPostJoinFilters() {
     return postJoinFilters;
   }
+  /**
+   * after merge join tree,update alias
+  * @Title: updateAlias
+  * @Description: TODO  
+  * @return void     
+  * @throws
+   */
+  public void updateAlias(){
+	  if(this.joinSrc == null){
+		  return ;
+	  }
+	  joinSrc.updateAlias();
+	  String[] leftAlias = new String[joinSrc.getLeftAliases().length+joinSrc.getRightAliases().length];
+	  System.arraycopy(joinSrc.getLeftAliases(), 0, leftAlias, 0, joinSrc.getLeftAliases().length);
+	  System.arraycopy(joinSrc.getRightAliases(), 0, leftAlias, joinSrc.getLeftAliases().length, joinSrc.getRightAliases().length);
+	  this.leftAliases = leftAlias;
+  }
+  
 }
Index: /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
===================================================================
--- /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java	(revision 85984)
+++ /BI/dp/hive-0.13.1-cdh5.2.0/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java	(working copy)
@@ -8938,6 +8938,7 @@
           }
         }
         mergeJoinTree(qb);
+        qb.getQbJoinTree().updateAlias();
       }
 
       // if any filters are present in the join tree, push them on top of the




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