拉链表起始时间转成多行日期

2022-11-13 13:03:29 浏览数 (1)

dataphin拉链表起始时间转成多行日期: (ps:dataphin split()怎么都识别不出空格,自闭了。。。替换成字符解决了)

代码语言:javascript复制
select a.*,b.*,dateadd(start_time,pos,'dd')
from (
select
'2021-10-01 00:00:00' as start_time,
'2021-10-03 00:00:00' as end_time
) a
lateral view posexplode(split(replace(space(datediff(end_time,start_time,'dd')),'','a'),'a')) b as pos,val ;

dataphin拉链表起始日期转成多行日期:

代码语言:javascript复制
select tf.*,t.*,date_add(start_date,pos)
from (
select  '2018-11-01' as start_date, '2018-11-02' as end_date 
) t
lateral view posexplode(split(replace(space(datediff(end_date,start_date)),'','a'),'a')) tf as pos,val ;

hive拉链表起始日期转成多行日期:

代码语言:javascript复制
select tf.*,t.*,date_add(start_date, pos) as mid_date
from (
select  '2018-11-01' as start_date, '2018-11-06' as end_date 
) t
lateral view posexplode(split(space(datediff(end_date,start_date)),'')) tf as pos,val ;

0 人点赞