insert into 竟然覆盖了原来的数据
问题
-
在使用hive的insert into 往表里插入数据时 ,却发现原来的数据被覆盖了。
-
无论insert 语句执行多少次,只会有最新的一条数据。(情况跟overwrite一样)
-
执行sql如下:
insert into table `test.test_data_table`
select 1,"yxw",'2021-09-09';
原因
-
通过问题查找,确定原因是由于表的两侧``的符号导致
-
使用`DatabaseName.TableName`时语法解析为OVERWRITE
解决办法
- 用户名和表名分别都加飘号:`test`.`test_data_table`
- 用户名和表名都别加:test.test_data_table
切记:不要用户名和表名都放在一个飘号里
报错not in the vectorization context column map
错误日志
org.apache.hadoop.hive.ql.metadata.HiveException:The column KEY._col2:0._col0 is not in the vectorization context column map {KEY._col0=0, KEY._col1=1, VALUE._col3=4, KEY._col2=2, VALUE._col4=5, VALUE._col5=6, VALUE._col1=3, VALUE._col6=7, VALUE._col7=8}.
原因
参考:www.jianshu.com/p/cb200f6bd…
解决办法:
set hive.vectorized.execution.enabled = false;
小提示:使用spark sql执行的话不存在这个问题