hive insert 动态分区异常(Error encountered near token)与解决


 

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM