分享

hive 的datediff函数bug请教

hello-world 发表于 2018-1-18 12:07:42 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 3 7860
我使用的hive-1.2.2,出现如下问题,正确答案是3,但是结果是2,求大神解答到底什么原因,怎么解决?
hive> select current_date(),from_unixtime(1516010468,'yyyy-MM-dd'), datediff(current_date(),from_unixtime(1516010468,'yyyy-MM-dd'));
OK
2018-01-18        2018-01-15        2


已有(3)人评论

跳转到指定楼层
nextuser 发表于 2018-1-18 14:05:34
看看是否所有的都是这样的,最好使用下todate转换下,再试试。如果都是这样的话,就在后面加上1
回复

使用道具 举报

hello-world 发表于 2018-1-18 14:32:48
但是这样又是正常的
hive> select datediff('2018-01-18','2018-01-15');
OK
3
Time taken: 1.355 seconds, Fetched: 1 row(s)


回复

使用道具 举报

hello-world 发表于 2018-1-18 14:39:56
这个问题解决了
to_date(current_date())
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条