You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Neil Xu <ne...@gmail.com> on 2010/12/28 09:18:25 UTC

Question about View in Hive 0.6

in hive 0.6, we can create view for tables, views are actually run as a
subquery when querying data, is it optimized in hive that a view is executed
only once in a single query? Thanks in advance!
such as:
  select *
  from (
      select x,y
      from view1
      where cond1

      union all

      select x,y
      from view1
      where cond2
  )

Neil,

Re: Question about View in Hive 0.6

Posted by John Sichi <js...@fb.com>.
It runs the same as a nested select.  Currently, since Hive doesn't do any relational common subexpression elimination, it will be executed twice.  In the example below, this can be a good thing, since cond1 and cond2 can be pushed down separately.

JVS

On Dec 28, 2010, at 12:18 AM, Neil Xu wrote:

> in hive 0.6, we can create view for tables, views are actually run as a subquery when querying data, is it optimized in hive that a view is executed only once in a single query? Thanks in advance!
> such as:
>   select *
>   from (
>       select x,y
>       from view1
>       where cond1
> 
>       union all
> 
>       select x,y
>       from view1
>       where cond2
>   )
> 
> Neil,
>