首页
学习
活动
专区
工具
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

    一个用来生成流水号的存储过程

    我们经常需要用一个流水号来唯一表示一条数据,我们有时采用队列来自动生成一个唯一的流水号,但是采用队列经常不能满足我们的需求,比如说,这个队列只能设定一个最小值,最大值,然后进行累加,不能将产生这个流水号的日期包括今这个流水号中;一种类型就要新建一个队列等。 下面这个存储过程可以产生一个流水号,它的格式是当前日期(格式YYYYMMDD)+6位的流水号数字,不同的类型只要给出一个不同的类型名称就可以了。在使用这个存储过程前,要先创建一个表来保存不同的类型,表结构如下: create table T_GENID (   CLASS   NUMBER(2) not null,   GENDATE CHAR(8) not null,   ID      VARCHAR2(12) not null ) tablespace SERVICE_MAIN_DAT   pctfree 10   pctused 80   initrans 1   maxtrans 255   storage   (     initial 1M     next 1M     minextents 1     maxextents unlimited     pctincrease 0   ); -- Create/Recreate primary, unique and foreign key constraints alter table T_GENID   add constraint PK_GENID primary key (CLASS,ID)   using index   tablespace SERVICE_MAIN_IDX   pctfree 10   initrans 2   maxtrans 255   storage   (     initial 1M     next 1M     minextents 1     maxextents unlimited     pctincrease 0   );

    01

    Bootstrap中datetimepicker日期控件1899年问题解决

    最近在开发项目的过程中,遇到一个很尴尬的问题。我们项目一直采用的是angular+bootstrap,日期控件用的是bootstrap中的datetimepicker,这个日期控件存在一个bug,当用户输入日期时,日期控件会自动跳到1899年,这个用户体验特别不好,一不小心就可能点错了。因为我们的项目中涉及的日期非常多,所以领导强烈要求我们前端解决这个问题,并且需要支持yyyy-MM-dd、yyyy/MM/dd、yyyy.MM.dd、yyyyMMdd等四种格式的兼容。作为前端中的一员,我不遗余力去从网上找答案,在百度上找了好几天,没有结果。就在最后,我忽然想到了github,在这上面我找到了我想要的答案。下面和大家分享一下。

    04
    领券