Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-9065

Multiple join Predicate Push Down error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 0.13.0
    • None
    • SQL
    • hadoop2.5 jdk1.7

    • filter

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            esnis yuebing.fu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0.4h
                0.4h
                Remaining:
                Remaining Estimate - 0.4h
                0.4h
                Logged:
                Time Spent - Not Specified
                Not Specified