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

Create view on tables having union all fail with "Table not found"

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 3.1.0, 4.0.0
    • Component/s: Hive
    • Labels:
      None
    • Environment:

      hive-1.2.1

       

    • Target Version/s:

      Description

      create view on table with union work well while "union all" failed with table not found, here are the reproduce steps.

      _hive> create table foo(id int);_
      _OK_
      _Time taken: 0.401 seconds_
      _hive> create table bar(id int);_
      _OK_
       
      _// view on table union_
      _hive> create view unionview as with tmp_1 as ( select * from foo ), tmp_2 as (select * from bar ) select * from tmp_1 union  select * from tmp_2;_ 
      _OK_
      _Time taken: 0.517 seconds_
      _hive> select * from unionview;_
      _OK_
      _Time taken: 5.805 seconds_
       
       
      _// view on union all_ 
      _hive> create view unionallview as with tmp_1 as ( select * from foo ), tmp_2 as (select * from bar ) select * from tmp_1 union all  select * from tmp_2;_ 
      _OK_
      _Time taken: 1.535 seconds_
      _hive> select * from unionallview;_
      _FAILED: SemanticException Line 1:134 Table not found 'tmp_1' in definition of VIEW unionallview [_
      _with tmp_1 as ( select `foo`.`id` from `default`.`foo` ), tmp_2 as (select `bar`.`id` from `default`.`bar` ) select `tmp_1`.`id` from tmp_1 union all  select `tmp_2`.`id` from tmp_2_
      _] used as unionallview at Line 1:14_
      _

      _

        Attachments

        1. HIVE-19259.03.patch
          56 kB
          Jesus Camacho Rodriguez
        2. HIVE-19259.02.patch
          50 kB
          Jesus Camacho Rodriguez
        3. HIVE-19259.01.patch
          47 kB
          Jesus Camacho Rodriguez
        4. HIVE-19259.patch
          26 kB
          Jesus Camacho Rodriguez

          Activity

            People

            • Assignee:
              jcamachorodriguez Jesus Camacho Rodriguez
              Reporter:
              Rajkumar Singh Rajkumar Singh
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: