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,
> 

Reply via email to