You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by zhangjp <sm...@hotmail.com> on 2015/04/01 05:06:52 UTC

hive union all same table

Hi  I want to query table_a by different where clause as follow
  select * from (      select  col1, count(1) from table_a where col2 ='xx' group by col1             union all     select  col1, count(1) from table_a where col2 ='xx' group by col1             union all      select  col1, count(1) from table_a where col2 ='xx' group by col1     )
I found the total jobs is 4, is there any optimiztion?  I think it should scan table_a once and only one job 		 	   		  

RE: hive union all same table

Posted by zhangjp <sm...@hotmail.com>.
hive> select ti,count(1) from xx  where day=20150330 group by ti    > union all    > select ti,count(1) from xx  where day=20150330 group by ti;Total jobs = 3Launching Job 1 out of 3
From: smartzjp@hotmail.com
To: user@hive.apache.org
Subject: hive  union all  same table
Date: Wed, 1 Apr 2015 03:06:52 +0000




Hi  I want to query table_a by different where clause as follow
  select * from (      select  col1, count(1) from table_a where col2 ='xx' group by col1             union all     select  col1, count(1) from table_a where col2 ='xx' group by col1             union all      select  col1, count(1) from table_a where col2 ='xx' group by col1     )
I found the total jobs is 4, is there any optimiztion?  I think it should scan table_a once and only one job