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