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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.1
    • 3.1.0, 4.0.0-alpha-1
    • Hive
    • None
    • hive-1.2.1

       

    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.01.patch
          47 kB
          jcamachorodriguez
        2. HIVE-19259.02.patch
          50 kB
          jcamachorodriguez
        3. HIVE-19259.03.patch
          56 kB
          jcamachorodriguez
        4. HIVE-19259.patch
          26 kB
          jcamachorodriguez

        Activity

          People

            jcamacho Jesús Camacho Rodríguez
            Rajkumar Singh Rajkumar Singh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: