Date variable in Hive

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 03:13: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 ?


回答1:


Correct Syntax is :

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



来源:https://stackoverflow.com/questions/34128776/date-variable-in-hive

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!