hive生成连续的时间和连续的数

select 
*,
DATE_ADD(t_start, n) AS pt
from (
SELECT 
    22 as uid
    ,'2024-10-01'as  t_start
    ,'2024-10-05'as  t_end
,11 as hh )t LATERAL
VIEW posexplode(split(space(DATEDIFF(t_end, t_start)), ' ')) k AS n,


22 2024-10-01 2024-10-05 11 0   2024-10-01
22 2024-10-01 2024-10-05 11 1   2024-10-02
22 2024-10-01 2024-10-05 11 2   2024-10-03
22 2024-10-01 2024-10-05 11 3   2024-10-04
22 2024-10-01 2024-10-05 11 4   2024-10-05

 

posted on 2024-10-12 21:59  大鹏的鸿鹄之志  阅读(42)  评论(0编辑  收藏  举报