Hive
  1. Hive
  2. HIVE-1398

Support union all without an outer select *

    Details

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

      Description

      In hive for union alls the query has to be wrapped in an sub query as shown below:

      select * from
      (select c1 from t1
      union all
      select c2 from t2);

      This JIRA proposes to fix that to support

      select c1 from t1
      union all
      select c2 from t2;

        Issue Links

          Activity

          Hide
          Raj Bains added a comment -

          Looks like it is fixed in Hive 0.14

          hive> insert into table foo1 select a,b from foo1 union all select a,b from foo3;
          Query ID = rbains_20141202142626_58807159-1762-4855-aa36-3fc3803b9ab7
          Total jobs = 1
          Launching Job 1 out of 1

          Status: Running (application id: application_1414029100044_2856)

          Map 1: / Map 3: /
          Status: Finished successfully
          Loading data to table default.foo1
          Table default.foo1 stats: [numFiles=4, numRows=0, totalSize=0, rawDataSize=0]
          OK
          Time taken: 2.575 seconds
          hive> insert into table foo1 select a,b from foo1 union all select x as a,y as b from foo2;
          Query ID = rbains_20141202143333_daaf52e4-7b15-413f-a0de-9b192cee2fcd
          Total jobs = 1
          Launching Job 1 out of 1

          Status: Running (application id: application_1414029100044_2856)

          Map 1: / Map 3: /
          Status: Finished successfully
          Loading data to table default.foo1
          Table default.foo1 stats: [numFiles=6, numRows=0, totalSize=0, rawDataSize=0]
          OK
          Time taken: 2.396 seconds
          hive>

          hive> insert into table foo1 select a,b from foo1 union all select x as a,y as b from foo2;
          Query ID = rbains_20141202143333_daaf52e4-7b15-413f-a0de-9b192cee2fcd
          Total jobs = 1
          Launching Job 1 out of 1

          Status: Running (application id: application_1414029100044_2856)

          Map 1: / Map 3: /
          Status: Finished successfully
          Loading data to table default.foo1
          Table default.foo1 stats: [numFiles=6, numRows=0, totalSize=0, rawDataSize=0]
          OK
          Time taken: 2.396 seconds
          hive>

          Show
          Raj Bains added a comment - Looks like it is fixed in Hive 0.14 hive> insert into table foo1 select a,b from foo1 union all select a,b from foo3; Query ID = rbains_20141202142626_58807159-1762-4855-aa36-3fc3803b9ab7 Total jobs = 1 Launching Job 1 out of 1 Status: Running (application id: application_1414029100044_2856) Map 1: / Map 3: / Status: Finished successfully Loading data to table default.foo1 Table default.foo1 stats: [numFiles=4, numRows=0, totalSize=0, rawDataSize=0] OK Time taken: 2.575 seconds hive> insert into table foo1 select a,b from foo1 union all select x as a,y as b from foo2; Query ID = rbains_20141202143333_daaf52e4-7b15-413f-a0de-9b192cee2fcd Total jobs = 1 Launching Job 1 out of 1 Status: Running (application id: application_1414029100044_2856) Map 1: / Map 3: / Status: Finished successfully Loading data to table default.foo1 Table default.foo1 stats: [numFiles=6, numRows=0, totalSize=0, rawDataSize=0] OK Time taken: 2.396 seconds hive> hive> insert into table foo1 select a,b from foo1 union all select x as a,y as b from foo2; Query ID = rbains_20141202143333_daaf52e4-7b15-413f-a0de-9b192cee2fcd Total jobs = 1 Launching Job 1 out of 1 Status: Running (application id: application_1414029100044_2856) Map 1: / Map 3: / Status: Finished successfully Loading data to table default.foo1 Table default.foo1 stats: [numFiles=6, numRows=0, totalSize=0, rawDataSize=0] OK Time taken: 2.396 seconds hive>
          Hide
          Ashutosh Chauhan added a comment -

          yes, via HIVE-6189

          Show
          Ashutosh Chauhan added a comment - yes, via HIVE-6189

            People

            • Assignee:
              Gunther Hagleitner
              Reporter:
              Ashish Thusoo
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development