hive partition function and with which the dynamic partition

Would like to complete a demand like this: insert overwrite table ... partiton (dt = date_sub ( '2019-03-13', 2))

 

Of course like this it is not feasible, partition behind the brackets is not a function of how to do it?

Online meal mad search to find a solution! Dynamic Partitioning

Two links to understand it:

https://stackoverflow.com/questions/44886583/parameter-passing-to-partition-is-not-working-in-hive

https://blog.csdn.net/qq_26442553/article/details/80382174

Anyway, it can be enforced, as follows:

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';

Guess you like

Origin www.cnblogs.com/amydi/p/10936204.html