hive向动态分区插入数据
2017-10-11 14:07
288 查看
向一个定义了分区的空表中插入数据,命令如下:
结果如下错误:
大概的意思是,在动态分区‘strict’模式下至少需要有一个’strict’列,可以通过设置hive.exec.dynamic.partition.mode=nonstrict来关闭’strict’模式。
至少需要一个’strict’分区列是指至少有一个分区列有至少一个值。
做如下设置:
运行成功。
set hive.exec.dynamic.partition.mode的设置貌似是一次性的,我自己使用的结果是设置完,跑一次插入之后,下一次对新的空动态分区表做插入,又报同样的错误,又设置一次之后,运行成功。
需要注意的是,系统自动将最后partition后的select中的最后n个字段作为n个分区列的值。
insert overwrite table t_name partition (par_1) select t1.field1 as field1, t1.field2 as field2, t1.field3 as par_1 from ( select * from t3 where par_2=value2) t1 where t1.field1 not in (select field1from t2) ;
结果如下错误:
大概的意思是,在动态分区‘strict’模式下至少需要有一个’strict’列,可以通过设置hive.exec.dynamic.partition.mode=nonstrict来关闭’strict’模式。
至少需要一个’strict’分区列是指至少有一个分区列有至少一个值。
做如下设置:
set hive.exec.dynamic.partition=true; set hive.exec.dynamic.partition.mode=nonstrict; set hive.exec.max.dynamic.partitions.pernode=1000;
运行成功。
set hive.exec.dynamic.partition.mode的设置貌似是一次性的,我自己使用的结果是设置完,跑一次插入之后,下一次对新的空动态分区表做插入,又报同样的错误,又设置一次之后,运行成功。
需要注意的是,系统自动将最后partition后的select中的最后n个字段作为n个分区列的值。
相关文章推荐
- HIVE动态分区插入数据
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive按当天日期建立分区表 | 动态往日期分区插入数据
- hive从查询中获取数据插入到表或动态分区
- hive从查询中获取数据插入到表或动态分区
- hive 分区partition表 创建 数据导入(动态分区插入、静态分区插入、动静态混合插入)
- hive从查询中获取数据插入到表或动态分区
- hadoop案例(一)--hive--2T数据动态创建分区
- 大数据Hive的案例、参数、动态分区、分桶、视图、索引、运行方式、权限管理、Hive的优化_03_03
- Hive 视图 索引 动态分区装载数据
- [置顶] hive 动态加载数据到指定分区,以及其他hive使用的技巧
- hadoop动态分区插入数据
- hive动态分区插入实验
- Hive动态分区与建表、插入数据操作
- Hive编程指南---动态分区插入