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

Support top level union all statements

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: None
    • Labels:
      None

      Description

      I've always wondered why union all has to be in subqueries in hive.

      After looking at it, problems are:

      • Hive Parser:
      • Union happens at the wrong place (insert ... select ... union all select ...) is parsed as (insert select) union select.
      • There are many rewrite rules in the parser to force any query into the a from - insert -select form. No doubt for historical reasons.
      • Plan generation/semantic analysis assumes top level "TOK_QUERY" and not top level "TOK_UNION".

      The rewrite rules don't work when we move the "UNION ALL" into the select statements. However, it's not hard to do that in code.

        Attachments

        1. HIVE-6189.1.patch
          83 kB
          Gunther Hagleitner
        2. HIVE-6189.2.patch
          89 kB
          Gunther Hagleitner
        3. HIVE-6189.3.patch
          71 kB
          Gunther Hagleitner

          Issue Links

            Activity

              People

              • Assignee:
                hagleitn Gunther Hagleitner
                Reporter:
                hagleitn Gunther Hagleitner
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: