首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

一个sql生成hive日期维度表

set hive.execution.engine=tez; with dates as ( select date_add("2010-01-01", a.pos) as d from (select posexplode(split(repeat("o", datediff("2030-12-31", "2010-01-01")), "o"))) a ) insert overwrite table dim.dim_date select     d   , date_format(d, 'yyyyMMdd000000') as to_pt            -- 指定分区格式   , date_format(d, 'yyyyMMdd')       as date_yyyymmdd   , trunc(d,'MM')                    as month_first_day    , last_day(d)                      as month_last_day   , date_format(last_day(d),'yyyyMMdd000000')   as month_last_pt   , date_format(d, 'yyyyMM')  as month_yyyymm   , date_format(d, 'yyyy-MM') as month_yyyy_mm   , month(d) as month   , date_format(d, 'u') as week   , date_format(d, 'E') as week_long      , weekofyear(d) as week_of_year   , year(d) as year   , floor(substr(d,6,2)/3.1)*3+1 as quarter   -- , concat_group('"',date_format(d, 'yyyyMM'),'"') as date_yyyymmdd_list   -- 低版本hive group_concat 不可用 from dates

03

Log4j中conversionPattern的含义「建议收藏」

%a — 表示礼拜几,英文缩写形式,比如“Fri” %A — 表示礼拜几,比如“Friday” %b — 表示几月份,英文缩写形式,比如“Oct” %B — 表示几月份,“October” %c — 标准的日期+时间格式,如 “Sat Oct 16 18:56:19 2004” %d — 表示今天是这个月的几号(1-31)“16” %H — 表示当前时刻是几时(0-23),如 “18” %I — 表示当前时刻是几时(1-12),如 “6” %j — 表示今天是哪一天(1-366),如 “290” %m — 表示本月是哪一月(1-12),如 “10” %M — 表示当前时刻是哪一分钟(0-59),如 “59” %p — 表示现在是上午还是下午, AM or PM %q — 表示当前时刻中毫秒部分(0-999),如 “237” %Q — 表示当前时刻中带小数的毫秒部分(0-999.999),如 “430.732” %S — 表示当前时刻的多少秒(0-59),如 “32” %U — 表示本周是今年的第几个礼拜,以周日为第一天开始计算(0-53),如 “41” %w — 表示礼拜几,(0-6, 礼拜天为0),如 “6” %W — 表示本周是今年的第几个礼拜,以周一为第一天开始计算(0-53),如 “41” %x — 标准的日期格式,如 “10/16/04” %X — 标准的时间格式,如 “19:02:34” %y — 两位数的年份(0-99),如 “04” %Y — 四位数的年份,如 “2004” %Z — 时区名,比如 “GMT”

02
领券