You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "@Sanjiv Singh" <sa...@gmail.com> on 2015/04/11 10:49:28 UTC

GROUPING() in hive

Hi,

I have given query , compatible to teradata. It have imported table in
dimension_tab using Sqoop. Tried to execute on HIVE , but unfortunately
compatible to hive.


SELECT fact_1_id,
       fact_2_id,
       SUM(sales_value) AS sales_value,
       *GROUPING(fact_1_id) AS f1g,
       GROUPING(fact_2_id) AS f2g*
FROM   dimension_tab
GROUP BY *CUBE (fact_1_id, fact_2_id)*
ORDER BY fact_1_id, fact_2_id;

Then I tried to make it HIVE compatible. Refer : WIKI
<https://cwiki.apache.org/confluence/display/Hive/Enhanced+Aggregation,+Cube,+Grouping+and+Rollup>

Fortunately,CUBE is available in HIVE , but with different syntax

i.e. *fact_1_id, fact_2_id WITH CUBE *. but form documentation,
GROUPING() is not available in HIVE.

Please help me if GROUPING() function is available in HIVE.
or
How can I make query running on HIVE?

Regards
Sanjiv Singh
Mob :  +091 9990-447-339