欢迎光临
我们一直在努力

hive-日期拆分为多行

hive-日期拆分为多行

代码

SELECT begin_date,
date_add(begin_date, tmp.pos),
end_date,
d_days,
tmp.pos,
tmp.val
FROM (
SELECT begin_date,
end_date,
DATEDIFF(end_date, begin_date) AS d_days
FROM (
SELECT '2025-08-01' AS begin_date,
'2025-08-10' AS end_date
) a
) b LATERAL VIEW posexplode(split(space(d_days), '')) tmp AS pos,
val

结果

begin_date_col1end_dated_dayspos
20250801202508012025081090
20250801202508022025081091
20250801202508032025081092
20250801202508042025081093
20250801202508052025081094
20250801202508062025081095
20250801202508072025081096
20250801202508082025081097
20250801202508092025081098
20250801202508102025081099

赞(0)
未经允许不得转载:171主机测评 » hive-日期拆分为多行
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址