Skip to content Skip to sidebar Skip to footer

How To View The Calculated Value Of A Hive Variable

I'm trying to see the value of a calculated value in hive. For example, I'm trying to get the year from this tablename: set TABLE_NAME = orders2014; set TABLE_YEAR = substr(${hivec

Solution 1:

Hive "variables" are actually nothing more than a text replacement mechanism.
The replacement is done before parsing and execution.

hive> set hivevar:v1=se;
hive> set hivevar:v2=l;
hive> set hivevar:v3=ec;
hive> set hivevar:v4=t 1+;
hive> set hivevar:v5=2;
hive> ${hivevar:v1}${hivevar:v2}${hivevar:v3}${hivevar:v4}${hivevar:v5};
OK
3

Post a Comment for "How To View The Calculated Value Of A Hive Variable"