Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.0
    • Fix Version/s: 0.8.0
    • Component/s: Query Processor
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      1)
      when considering to choose one table as the big table candidate for a map join, if at compile time, hive can find out that the total known size of all other tables excluding the big table in consideration is bigger than a configured value, this big table candidate is a bad one, and should not put into plan. Otherwise, at runtime to filter this out may cause more time.

      2)
      added a null check for back up tasks. Otherwise will see NullPointerException

      3)
      CommonJoinResolver needs to know a full mapping of pathToAliases. Otherwise it will make wrong decision.

      4)
      changes made to the ConditionalResolverCommonJoin: added pathToAliases, aliasToSize (alias's input size that is known at compile time, by inputSummary), and intermediate dir path.
      So the logic is, go over all the pathToAliases, and for each path, if it is from intermediate dir path, add this path's size to all aliases. And finally based on the size information and others like aliasToTask to choose the big table.

      5)
      Conditional task's children contains wrong options, which may cause join fail or incorrect results. Basically when getting all possible children for the conditional task, should use a whitelist of big tables. Only tables in this while list can be considered as a big table.
      Here is the logic:

      • Get a list of big table candidates. Only the tables in the returned set can be used as big table in the join operation.
      • The logic here is to scan the join condition array from left to right.
        • If see a inner join and the bigTableCandidates is empty, add both side of this inner join to big table candidates.
        • If see a left outer join, and the bigTableCandidates is empty, add the left side to it, and
        • if the bigTableCandidates is not empty, do nothing (which means the bigTableCandidates is from left side).
        • If see a right outer join, clear the bigTableCandidates, and add right side to the bigTableCandidates, it means the right side of a right outer join always win.
        • If see a full outer join, return null immediately (no one can be the big table, can not do a mapjoin).
      1. HIVE-2095.1.patch
        494 kB
        He Yongqiang
      2. HIVE-2095.2.patch
        497 kB
        He Yongqiang

        Activity

        He Yongqiang created issue -
        He Yongqiang made changes -
        Field Original Value New Value
        Summary auto convert map join should not be triggered if the input size is bigger than a configured value. auto convert map join bug
        Description If auto convert join is set to true, it should fall back to common join if the input size of each join table is bigger than a configured value. 1)
        when considering to choose one table as the big table candidate for a map join, if at compile time, hive can find out that the total known size of all other tables excluding the big table in consideration is bigger than a configured value, this big table candidate is a bad one, and should not put into plan. Otherwise, at runtime to filter this out may cause more time.

        2)
        added a null check for back up tasks. Otherwise will see NullPointerException

        3)
        CommonJoinResolver needs to know a full mapping of pathToAliases. Otherwise it will make wrong decision.

        4)
        changes made to the ConditionalResolverCommonJoin: added pathToAliases, aliasToSize (alias's input size that is known at compile time, by inputSummary), and intermediate dir path.
        So the logic is, go over all the pathToAliases, and for each path, if it is from intermediate dir path, add this path's size to all aliases. And finally based on the size information and others like aliasToTask to choose the big table.

        5)
        Conditional task's children contains wrong options, which may cause join fail or incorrect results. Basically when getting all possible children for the conditional task, should use a whitelist of big tables. Only tables in this while list can be considered as a big table.
        Here is the logic:

        + * Get a list of big table candidates. Only the tables in the returned set can
        + * be used as big table in the join operation.
        + *
        + * The logic here is to scan the join condition array from left to right. If
        + * see a inner join and the bigTableCandidates is empty, add both side of this
        + * inner join to big table candidates. If see a left outer join, and the
        + * bigTableCandidates is empty, add the left side to it, and if the
        + * bigTableCandidates is not empty, do nothing (which means the
        + * bigTableCandidates is from left side). If see a right outer join, clear the
        + * bigTableCandidates, and add right side to the bigTableCandidates, it means
        + * the right side of a right outer join always win. If see a full outer join,
        + * return null immediately (no one can be the big table, can not do a
        + * mapjoin).
        He Yongqiang made changes -
        Attachment HIVE-2095.1.patch [ 12475691 ]
        He Yongqiang made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Liyin Tang added a comment -

        I will take a look

        Show
        Liyin Tang added a comment - I will take a look
        Hide
        Namit Jain added a comment -

        Can you also create a review-board request ?

        Show
        Namit Jain added a comment - Can you also create a review-board request ?
        Show
        He Yongqiang added a comment - https://reviews.apache.org/r/559/
        Namit Jain made changes -
        Status Patch Available [ 10002 ] Open [ 1 ]
        Hide
        Liyin Tang added a comment -

        it looks good to me. Thanks Yongqiang

        Show
        Liyin Tang added a comment - it looks good to me. Thanks Yongqiang
        He Yongqiang made changes -
        Attachment HIVE-2095.2.patch [ 12475785 ]
        Hide
        He Yongqiang added a comment -

        Uploading a new patch to address namit's comments.

        Note, there is an existing bug in hive that cause results of auto_join29.q is not correct.
        Let's file another jira for it.
        basically, if the outer join filter is enabled, the query "SELECT /+mapjoin(src1, src2)/ * FROM src src1 RIGHT OUTER JOIN src src2 ON (src1.key = src2.key AND src1.key < 10 AND src2.key > 10) JOIN src src3 ON (src2.key = src3.key AND src3.key < 10) SORT BY src1.key, src1.value, src2.key, src2.value, src3.key, src3.value;" will give wrong results in today's hive.

        Show
        He Yongqiang added a comment - Uploading a new patch to address namit's comments. Note, there is an existing bug in hive that cause results of auto_join29.q is not correct. Let's file another jira for it. basically, if the outer join filter is enabled, the query "SELECT / +mapjoin(src1, src2) / * FROM src src1 RIGHT OUTER JOIN src src2 ON (src1.key = src2.key AND src1.key < 10 AND src2.key > 10) JOIN src src3 ON (src2.key = src3.key AND src3.key < 10) SORT BY src1.key, src1.value, src2.key, src2.value, src3.key, src3.value;" will give wrong results in today's hive.
        Hide
        Namit Jain added a comment -

        Committed. Thanks Yongqiang

        Show
        Namit Jain added a comment - Committed. Thanks Yongqiang
        Namit Jain made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Hadoop Flags [Reviewed]
        Resolution Fixed [ 1 ]
        Carl Steinbach made changes -
        Fix Version/s 0.8.0 [ 12316178 ]
        Affects Version/s 0.7.0 [ 12315150 ]
        Component/s Query Processor [ 12312586 ]
        Carl Steinbach made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Matt Kleiderman added a comment -

        I think I'm hitting this issue with an 0.7.1 installation - can you provide information about how big the tables need to be in order to trigger the NullPointerException?

        Show
        Matt Kleiderman added a comment - I think I'm hitting this issue with an 0.7.1 installation - can you provide information about how big the tables need to be in order to trigger the NullPointerException?
        Aniket Mokashi made changes -
        Description 1)
        when considering to choose one table as the big table candidate for a map join, if at compile time, hive can find out that the total known size of all other tables excluding the big table in consideration is bigger than a configured value, this big table candidate is a bad one, and should not put into plan. Otherwise, at runtime to filter this out may cause more time.

        2)
        added a null check for back up tasks. Otherwise will see NullPointerException

        3)
        CommonJoinResolver needs to know a full mapping of pathToAliases. Otherwise it will make wrong decision.

        4)
        changes made to the ConditionalResolverCommonJoin: added pathToAliases, aliasToSize (alias's input size that is known at compile time, by inputSummary), and intermediate dir path.
        So the logic is, go over all the pathToAliases, and for each path, if it is from intermediate dir path, add this path's size to all aliases. And finally based on the size information and others like aliasToTask to choose the big table.

        5)
        Conditional task's children contains wrong options, which may cause join fail or incorrect results. Basically when getting all possible children for the conditional task, should use a whitelist of big tables. Only tables in this while list can be considered as a big table.
        Here is the logic:

        + * Get a list of big table candidates. Only the tables in the returned set can
        + * be used as big table in the join operation.
        + *
        + * The logic here is to scan the join condition array from left to right. If
        + * see a inner join and the bigTableCandidates is empty, add both side of this
        + * inner join to big table candidates. If see a left outer join, and the
        + * bigTableCandidates is empty, add the left side to it, and if the
        + * bigTableCandidates is not empty, do nothing (which means the
        + * bigTableCandidates is from left side). If see a right outer join, clear the
        + * bigTableCandidates, and add right side to the bigTableCandidates, it means
        + * the right side of a right outer join always win. If see a full outer join,
        + * return null immediately (no one can be the big table, can not do a
        + * mapjoin).
        1)
        when considering to choose one table as the big table candidate for a map join, if at compile time, hive can find out that the total known size of all other tables excluding the big table in consideration is bigger than a configured value, this big table candidate is a bad one, and should not put into plan. Otherwise, at runtime to filter this out may cause more time.

        2)
        added a null check for back up tasks. Otherwise will see NullPointerException

        3)
        CommonJoinResolver needs to know a full mapping of pathToAliases. Otherwise it will make wrong decision.

        4)
        changes made to the ConditionalResolverCommonJoin: added pathToAliases, aliasToSize (alias's input size that is known at compile time, by inputSummary), and intermediate dir path.
        So the logic is, go over all the pathToAliases, and for each path, if it is from intermediate dir path, add this path's size to all aliases. And finally based on the size information and others like aliasToTask to choose the big table.

        5)
        Conditional task's children contains wrong options, which may cause join fail or incorrect results. Basically when getting all possible children for the conditional task, should use a whitelist of big tables. Only tables in this while list can be considered as a big table.
        Here is the logic:

        * Get a list of big table candidates. Only the tables in the returned set can be used as big table in the join operation.
        * The logic here is to scan the join condition array from left to right.
        ** If see a inner join and the bigTableCandidates is empty, add both side of this inner join to big table candidates.
        ** If see a left outer join, and the bigTableCandidates is empty, add the left side to it, and
        ** if the bigTableCandidates is not empty, do nothing (which means the bigTableCandidates is from left side).
        ** If see a right outer join, clear the bigTableCandidates, and add right side to the bigTableCandidates, it means the right side of a right outer join always win.
        ** If see a full outer join, return null immediately (no one can be the big table, can not do a mapjoin).

          People

          • Assignee:
            He Yongqiang
            Reporter:
            He Yongqiang
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development