Modfiy the query to :
select totalcount / sum(totalcount) from daily_count_per_kg_domain where
timestamp_dt = '20140219' group by timestamp_dt;

if you dont specify the where clause, you will get result for all
partitions.


On Tue, Feb 25, 2014 at 3:14 PM, Manish <[email protected]> wrote:

> I have a partitioned table  on timestamp_dt:
>
> > desc daily_count_per_kg_domain;
> OK
> ddnamesyskg     string
> totalcount      int
> timestamp_dt    string
>
> hive> select * from daily_count_per_kg_domain;
> OK
> sys_kg_band     224     20140219
> sys_kg_event    3435    20140219
> sys_kg_movies   44987   20140219
> sys_kg_oly      4172    20140219
> sys_kg_sp_countr        5499    20140219
> sys_kg_sports   3954    20140219
> sys_kg_tv       21387   20140219
> sys_kg_venue    152     20140219
> sys_kgathlete   9000    20140219
> sys_kgpeople    300064  20140219
>
>
> Looking to compute percentages for each row, (per day):
>
> 100* totalcount / sum(totalcount)
>
>
> Intuitively i tried :
> > select totalcount / sum(totalcount) from daily_count_per_kg_domain where
> timestamp_dt = '20140219' ;
>
> FAILED: SemanticException [Error 10025]: Line 1:7 Expression not in GROUP
> BY key 'totalcount'
>
> I am not sure what group by on totalcount means..
>
> Any ides ?
>
>
>

Reply via email to