sql日期表

set hive.execution.engine=tez;
with dates as (
select date_add("2000-01-01", a.pos) as d
from (select posexplode(split(repeat("o", datediff("2023-12-31", "2000-01-01")), "o"))) a
)

--insert overwrite table dim_date
select
row_number() over(order by 1) as id
, d as day_yyyy_mm_dd
, year(d) as year_desc
, lpad(ceil(month(d)/3),2,0) as season
, month(d) as month_desc

from dates

posted @ 2023-08-13 22:26  半个程序猿Cohen_Lee  阅读(15)  评论(0编辑  收藏  举报