蜂巢中间隔的范围 [英] range between interval in Hive

查看:85
本文介绍了蜂巢中间隔的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美好的一天,请给我建议,我该如何替换此Oracle语法:

Good day, Give me advice,please, How can i replace this Oracle syntax:

sum(fact) over(partition by name order by rep_date range between interval '20' month preceding and current row) as w_sum

要在Hive中使用它?我有一个与时间间隔"20"有关的错误

to use it in Hive? I have a mistake related with interval '20'

推荐答案

使用unix_timestamp将rep_date转换为Unix纪元以来的秒数,然后计算20个月的秒数,并在两者之间的范围内使用.Hive不支持在范围内指定间隔类型.

Convert the rep_date into seconds since Unix epoch using unix_timestamp and then calculate the seconds for 20 months and use it in the range,between. Hive does not support specifying interval type in range.

sum(fact) over(
    partition by name 
    order by unix_timestamp(rep_date,'MM-dd-yyyy') -- Specify the rep_date format here
    range between 51840000 preceding and current row) as w_sum

这篇关于蜂巢中间隔的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆