drop table if exists ods_energy_week_day;
create table if not exists ods_energy_week_day (
    id integer,
    project_id string comment "项目id",
    `date` string comment "yyyyMMdd，日期",
    energy_cooling decimal(10, 4) comment "中央供冷系统，能耗",
    energy_heating decimal(10, 4)  comment "中央供热系统，能耗",
    energy_ac_terminal decimal(10, 4) comment "空调末端系统，能耗",
    energy_light decimal(10, 4) comment "照明系统，能耗",
    energy_others decimal(10, 4) comment "其它，能耗",
    create_time string comment "创建时间",
    update_time string comment "更新时间"
) COMMENT '能耗系统'
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\001'
STORED AS TEXTFILE
LOCATION
'hdfs://sagaCluster:8020/warehouse/saga_dw/ods/ods_energy_week_day'
TBLPROPERTIES (
'orc.compress'='lzo');

/** 历史数据 */
create table ods_energy_15_min_history
(
    building   string,
    func_id    string,
    meter      string,
    data_time  string,
    data_value decimal(20, 15),
    `dt` string
) 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_history'
TBLPROPERTIES (
  'orc.compress'='lzo');