123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #!/bin/bash
- env_config="
- use saga_dw;
- SET mapreduce.job.queuename=hive;
- SET hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
- SET hive.exec.dynamic.partition.mode=nonstrict;"
- ods_energy_15_min="
- insert into saga_dw.ods_energy_15_min partition(dt)
- select
- building,
- func_id,
- meter,
- data_time,
- data_value,
- dt
- from saga_dw.ods_energy_15_min_history;"
- ods_energy_5_min="
- insert into saga_dw.ods_energy_5_min partition(dt)
- select
- building,
- func_id,
- meter,
- data_time,
- data_value,
- dt
- from saga_dw.ods_energy_5_min_history;"
- ods_energy_15_min_fjd="
- insert into saga_dw.ods_energy_15_min_fjd partition(dt)
- select
- building,
- func_id,
- meter,
- data_time,
- data_value,
- dt
- from saga_dw.ods_energy_15_min_fjd_history;"
- ods_energy_5_min_fjd="
- insert into saga_dw.ods_energy_5_min_fjd partition(dt)
- select
- building,
- func_id,
- meter,
- data_time,
- data_value,
- dt
- from saga_dw.ods_energy_5_min_fjd_history;"
- insert_into_table(){
- case $1 in
- "energy_15_min")
- echo $1
- hive -e "$env_config$ods_energy_15_min$ods_energy_15_min_fjd"
- ;;
- "energy_5_min")
- echo $1
- hive -e "$env_config$ods_energy_5_min$ods_energy_5_min_fjd"
- ;;
- "ods_energy_15_min")
- echo $1
- hive -e "$env_config$ods_energy_15_min"
- ;;
- "ods_energy_5_min")
- echo $1
- hive -e "$env_config$ods_energy_5_min"
- ;;
- "ods_energy_15_min_fjd")
- echo $1
- hive -e "$env_config$ods_energy_15_min_fjd"
- ;;
- "ods_energy_5_min_fjd")
- echo $1
- hive -e "$env_config$ods_energy_5_min_fjd"
- ;;
- esac
- }
|