hive 种实现类似 这种 (hive中不支持)
insert overwrite table ******** partition(dt = date_add(’{date}’,3))
select
1 第一种方法
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
insert into table ts.dyy_test partition(dt)
select a,b,date_sub(‘2019-03-23’,2) dt from asdf.sldfjkskdjfllsjkkf
where dt=‘2019-03-15’;
2。第二种方法
set hive.exec.dynamic.partition.mode=nonstrict;
SET runmdt = date_sub(current_date,5);
INSERT OVERWRITE TABLE amobe_tbl PARTITION (create_dt)
SELECT
cal_id,caller_name,location,
hiveconf:runmdtfromamobetblaWHEREa.createdtIN(selectDISTINCTcreatedtfrommtcallWHEREcreatedtbetweendatesub(currentdate,20)andcurrentdate)anda.createdt={hiveconf:runmdt}
from
amobe_tbl a
WHERE a.create_dt IN
(
select DISTINCT create_dt from mt_call
WHERE create_dt between date_sub(current_date,20) and current_date)
and a.create_dt=hiveconf:runmdtfromamobetblaWHEREa.createdtIN(selectDISTINCTcreatedtfrommtcallWHEREcreatedtbetweendatesub(currentdate,20)andcurrentdate)anda.createdt={hiveconf:runmdt};
参考:https://stackoverflow.com/questions/44886583/parameter-passing-to-partition-is-not-working-in-hive
和:https://www.cnblogs.com/amydi/p/10936204.html