Date variable in Hive

2019-09-03 09:09发布

I am using following code to set date in Hive

SET DATE_DM2=date_sub(from_unixtime(unix_timestamp(),'yyyy/MM/dd'), cast(((from_unixtime(unix_timestamp(), 'u') % 7)+1) as int));

But When I am running the following select statement I am not getting the output

select * from TableName where partitiondate='${DATE_DM2}';

Is there anything wrong with the syntax ?

标签: hive hiveql
1条回答
Bombasti
2楼-- · 2019-09-03 09:31

Correct Syntax is :

select * from TableName where partitiondate='${hiveconf:DATE_DM2}';

查看更多
登录 后发表回答