Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Setting value into hive varialble

Copy link to this message
Setting value into hive varialble
Hello All,
I have a case statement, where I need to check the date passed through

If date is 1st date of the month then keep it as it as
set the parameter date to 1st date of the month.

and then later opretation are being performed on that date into hive quries,
I have wrote this Hive QL

   *select case when as_of_dt = ${hivevar:as_of_dt} then
${hivevar:as_of_dt} else date_sub(${hivevar:as_of_dt} ,
(day(${hivevar:as_of_dt} )) -1 ) end as as_of_dt from TABLE group by
as_of_dt ;*

I want to store the value of this Query int a variable.

like MY_VARIABLE = output of this query;

How to achive that.

Pls suggest,
Thanks in advance