(1) acquisition parameters: parameters coming from the shell file, call: $ 1, $ 2, $ 3
load_date=$1
clearn_date=`date -d"$2 day ago $load_date" +%Y-%m-%d`
local_path=$3
(2) the implementation of HIVE:
is directly behind the hive -e double quotes splicing hivesql statement , then the command can be executed
hive -e "ALTER TABLE dm_kg.dwd_intopieces DROP IF EXISTS PARTITION(etl_date='$clearn_date')"
specified later hive -f is a file , and then write directly inside sql file, you can run the sql hive
hive -f $local_path/hive.hsql
(3) shell define variables
hive -hiveconf day=20151115 -f test.sql
(4) sql file called variable
select * from ods.tracklog where day='${hiveconf:day}'
(1) acquisition parameters: parameters coming from the shell file, call: $ 1, $ 2, $ 3
load_date=$1
clearn_date=`date -d"$2 day ago $load_date" +%Y-%m-%d`
local_path=$3
(2) the implementation of HIVE:
is directly behind the hive -e double quotes splicing hivesql statement , then the command can be executed
hive -e "ALTER TABLE dm_kg.dwd_intopieces DROP IF EXISTS PARTITION(etl_date='$clearn_date')"
specified later hive -f is a file , and then write directly inside sql file, you can run the sql hive
hive -f $local_path/hive.hsql
(3) shell define variables
hive -hiveconf day=20151115 -f test.sql
(4) sql file called variable
select * from ods.tracklog where day='${hiveconf:day}'