|
@@ -1,3 +1,5 @@
|
|
|
+create database saga_dw location "/saga/saga_dw";
|
|
|
+
|
|
|
/** 能源原始数据 15min 差值 */
|
|
|
create table ods_energy_15_min
|
|
|
(
|
|
@@ -7,47 +9,13 @@ create table ods_energy_15_min
|
|
|
data_time string,
|
|
|
data_value decimal(30, 15)
|
|
|
) COMMENT '能源原始数据15min差值数据'
|
|
|
-PARTITIONED BY (`dt` string)
|
|
|
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
-STORED AS TEXTFILE
|
|
|
-LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_15_min'
|
|
|
-TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|
|
|
-
|
|
|
-/** 能源原始数据 15min 差值临时表 */
|
|
|
-create table ods_energy_15_min_tmp
|
|
|
-(
|
|
|
- building string,
|
|
|
- func_id string,
|
|
|
- meter string,
|
|
|
- data_time string,
|
|
|
- data_value decimal(30, 15)
|
|
|
-) COMMENT '能源原始数据15min差值临时表'
|
|
|
PARTITIONED BY (`dt` string)
|
|
|
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
-STORED AS TEXTFILE
|
|
|
-LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_15_min_tmp'
|
|
|
-TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|
|
|
-
|
|
|
-/** 能源原始数据 5min 差值 */
|
|
|
-create table ods_energy_5_min
|
|
|
-(
|
|
|
- building string,
|
|
|
- func_id string,
|
|
|
- meter string,
|
|
|
- data_time string,
|
|
|
- data_value decimal(30, 15)
|
|
|
-) COMMENT '能源原始数据15min差值数据'
|
|
|
-PARTITIONED BY (`dt` string)
|
|
|
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
-STORED AS TEXTFILE
|
|
|
-LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_5_min'
|
|
|
-TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|
|
|
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
+ STORED AS TEXTFILE
|
|
|
+ LOCATION
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_energy_15_min'
|
|
|
+ TBLPROPERTIES (
|
|
|
+ 'orc.compress'='lzo');
|
|
|
|
|
|
/** 能源数据 15min */
|
|
|
create table ods_energy_15_min_fjd
|
|
@@ -58,30 +26,13 @@ create table ods_energy_15_min_fjd
|
|
|
data_time string,
|
|
|
data_value decimal(30, 15)
|
|
|
) COMMENT '能源原始数据 15min'
|
|
|
-PARTITIONED BY (`dt` string)
|
|
|
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
-STORED AS TEXTFILE
|
|
|
-LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_15_min_fjd'
|
|
|
-TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|
|
|
-
|
|
|
-/** 能源数据 5min */
|
|
|
-create table ods_energy_5_min_fjd
|
|
|
-(
|
|
|
- building string,
|
|
|
- func_id string,
|
|
|
- meter string,
|
|
|
- data_time string,
|
|
|
- data_value decimal(30, 15)
|
|
|
-) COMMENT '能源原始数据 5min'
|
|
|
-PARTITIONED BY (`dt` string)
|
|
|
-ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
-STORED AS TEXTFILE
|
|
|
-LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_5_min_fjd'
|
|
|
-TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|
|
|
+ PARTITIONED BY (`dt` string)
|
|
|
+ ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
+ STORED AS TEXTFILE
|
|
|
+ LOCATION
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_energy_15_min_fjd'
|
|
|
+ TBLPROPERTIES (
|
|
|
+ 'orc.compress'='lzo');
|
|
|
|
|
|
/** 能源数据按小时 */
|
|
|
create table saga_dw.dwd_energy_15_min_hour
|
|
@@ -101,7 +52,7 @@ create table saga_dw.dwd_energy_15_min_hour
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/dwd/dwd_energy_15_min_hour'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/dwd/dwd_energy_15_min_hour'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress' = 'lzo');
|
|
|
|
|
@@ -119,7 +70,7 @@ create table ods_co2_15_min
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_co2_15_min'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_co2_15_min'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress'='lzo');
|
|
|
|
|
@@ -136,7 +87,7 @@ create table ods_pm25_15_min
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_pm25_15_min'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_pm25_15_min'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress'='lzo');
|
|
|
|
|
@@ -153,7 +104,7 @@ create table ods_hcho_15_min
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_hcho_15_min'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_hcho_15_min'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress'='lzo');
|
|
|
|
|
@@ -170,7 +121,7 @@ create table ods_temperature_15_min
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_temperature_15_min'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_temperature_15_min'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress'='lzo');
|
|
|
|
|
@@ -187,23 +138,6 @@ create table ods_humidity_15_min
|
|
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
STORED AS TEXTFILE
|
|
|
LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_humidity_15_min'
|
|
|
+ 'hdfs://HDFS85113:8020/saga/saga_dw/ods/ods_humidity_15_min'
|
|
|
TBLPROPERTIES (
|
|
|
'orc.compress'='lzo');
|
|
|
-
|
|
|
-
|
|
|
-create table ods_history_tmp
|
|
|
-(
|
|
|
- building string,
|
|
|
- func_id string,
|
|
|
- meter string,
|
|
|
- data_time string,
|
|
|
- data_value decimal(30, 15)
|
|
|
-) COMMENT '历史数据中间表'
|
|
|
- PARTITIONED BY (`dt` string)
|
|
|
- ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
|
|
|
- STORED AS TEXTFILE
|
|
|
- LOCATION
|
|
|
- 'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/tmp/ods_history_tmp'
|
|
|
- TBLPROPERTIES (
|
|
|
- 'orc.compress'='lzo');
|