|
@@ -0,0 +1,45 @@
|
|
|
+-- 支路维度
|
|
|
+create table saga_dw.dim_office_meter
|
|
|
+(
|
|
|
+ id integer,
|
|
|
+ meter integer comment '表号',
|
|
|
+ branch_code string comment '支路编码',
|
|
|
+ branch_name string comment '支路名称',
|
|
|
+ use_range string comment '区域范围'
|
|
|
+) COMMENT '支路维度'
|
|
|
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
+ STORED AS TEXTFILE
|
|
|
+ LOCATION
|
|
|
+ 'hdfs://sagaCluster:8020/warehouse/saga_dw/dim/dim_office_meter'
|
|
|
+ TBLPROPERTIES (
|
|
|
+ 'orc.compress' = 'lzo');
|
|
|
+
|
|
|
+
|
|
|
+-- 时间维度数据
|
|
|
+create table saga_dw.dim_date_day
|
|
|
+(
|
|
|
+ date_id string,
|
|
|
+ week_of_year integer comment '这一年的第几周',
|
|
|
+ day_of_year integer comment '这一年的第几天',
|
|
|
+ day_of_mouth integer comment '这一月的第几天',
|
|
|
+ type string comment '0 工作日 1 假日 2 节假日',
|
|
|
+ date_type string comment 'type 的英文',
|
|
|
+ index_work_day_of_month integer comment '如果当前是工作日 则返回是当前月的第几个工作日,否则返回0',
|
|
|
+ week_day integer comment '星期几',
|
|
|
+ week_day_cn string comment '星期中文',
|
|
|
+ week_day_en string comment '星期英文',
|
|
|
+ current_year integer comment '年份',
|
|
|
+ current_quarter integer comment '季度',
|
|
|
+ year_quarter string comment '年份-季度',
|
|
|
+ mouth integer comment '月份',
|
|
|
+ year_mouth string comment '年份-月份',
|
|
|
+ is_first_day_mouth integer comment '是当月第一天 0:false 1:true',
|
|
|
+ is_last_day_mouth integer comment '是当月最后一天 0:false 1:true',
|
|
|
+ type_des string comment '类型描述 比如 国庆,休息日,工作日'
|
|
|
+) COMMENT '时间维度数据'
|
|
|
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
+ STORED AS TEXTFILE
|
|
|
+ LOCATION
|
|
|
+ 'hdfs://sagaCluster:8020/warehouse/saga_dw/dim/dim_date_day'
|
|
|
+ TBLPROPERTIES (
|
|
|
+ 'orc.compress' = 'lzo');
|