當insert數據到有分區的hive表里時若不明顯指定分區會拋出異常
insert overwrite table persons_tmp select * from persons;
FAILED: SemanticException 1:23 Need to specify partition columns because the destination table is partitioned. Error encountered near token 'persons_tmp'
當指定分區后又會有非嚴格模式異常
insert overwrite table persons_tmp partition(dt,bs) select * from persons;
FAILED: SemanticException [Error 10096]: Dynamic partition strict mode requires at least one static partition column. To turn this off set hive.exec.dynamic.partition.mode=nonstrict
此時依據錯誤提示set好非嚴格模式即可
set hive.exec.dynamic.partition.mode=nonstrict;
insert overwrite table persons_tmp partition(dt,bs) select * from persons;