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

Provide support for complex expressions in ON clauses for INNER joins

Log workAgile BoardRank to TopRank to BottomVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0
    • 2.2.0
    • CBO, Parser
    • None


      Currently, we have some restrictions on the predicates that we can use in ON clauses for inner joins (we have those restrictions for outer joins too, but we will tackle that in a follow-up). Semantically equivalent queries can be expressed if the predicate is introduced in the WHERE clause, but we would like that user can express it both in ON and WHERE clause, as in standard SQL.

      This patch is an extension to overcome these restrictions for inner joins.

      It will allow to write queries that currently fail in Hive such as:

      -- Disjunctions
      SELECT *
      FROM src1 JOIN src
      ON (src1.key=src.key
        OR src1.value between 100 and 102
        OR src.value between 100 and 102)
      LIMIT 10;
      -- Conjunction with multiple inputs references in one side
      SELECT *
      FROM src1 JOIN src
      ON (src1.key+src.key >= 100
        AND src1.key+src.key <= 102)
      LIMIT 10;
      -- Conjunct with no references
      SELECT *
      FROM src1 JOIN src
      ON (src1.value between 100 and 102
        AND src.value between 100 and 102
        AND true)
      LIMIT 10;


        1. HIVE-15211.01.patch
          97 kB
          Jesus Camacho Rodriguez
        2. HIVE-15211.patch
          82 kB
          Jesus Camacho Rodriguez

        Issue Links


          This comment will be Viewable by All Users Viewable by All Users


            jcamachorodriguez Jesus Camacho Rodriguez Assign to me
            jcamachorodriguez Jesus Camacho Rodriguez
            0 Vote for this issue
            4 Start watching this issue



              Issue deployment