hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Vonkip <>
Subject Dynamic "set" command
Date Thu, 23 Feb 2012 18:59:56 GMT
Hi folks,

I am running a hive script that currently takes in the variables T, T_PREV, etc.  These are
used for, amonst other things, adding paritions.  For example:

alter table my_table add if not exists partition (dt='${T}');
alter table my_table add if not exists partition (dt='${T_PREV}');
The format of T, T_PREV, and subsequent variables is 'yyyy-MM-dd-HH'.  I'd like to pass in
only T and calculate the others in the .q script.  In MySQL, I'd do this by setting a local
variable (hiveconf domain?) based on a calculation (e.g., convert to unix_timestamp, subtract
an hour, convert back to string).  But I can't seem to find a way to do this dynamically
in Hive.  Am I missing something?

Matt VonKip

View raw message