hive数据仓库delete操作Attempt to do update or delete using transaction manager that does not support these

问题

hive数据仓库执行delete操作,交互式命令行提示

FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.

详细问题

在这里插入图片描述

解决方案

1 编辑hive-site.xml(位于hive安装目录/conf),增加以下配置

<property>
	<name>hive.support.concurrency</name>
	<value>true</value>
</property>
<property>
	<name>hive.enforce.bucketing</name>
	<value>true</value>
</property>
<property>
	<name>hive.exec.dynamic.partition.mode</name>
	<value>nonstrict</value>
</property>
<property>
	<name>hive.txn.manager</name>
	<value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value></property>
<property>
	<name>hive.compactor.initiator.on</name>
	<value>true</value>
</property>

2 退出hive 命令行,执行

hive

重新进入hive(若此次报错,表明hive-site.xml配置有误)
3 修改建表语句
若创建表时未配置

clustered by (id) into 2 buckets
stored as orc 
TBLPROPERTIES('transactional'='true');  

属性,需重新建立表,并配置上述属性。
以笔者为例,具体建表语句
在这里插入图片描述
4 数据导入
将之前数据导入hive数据库
5 测试
在这里插入图片描述
删除成功

原因

1 在hive上执行事务操作(增删改查)自hive从0.14版本支持,但对于数据的(删改)但并不是默认支持,需要修改参数,如果不修改参数配置,会报上述异常,上文中第一步即为配置hive上执行事务操作(增删改查)所需配置。同时,Hive对使用Update(删改)功能的表有特定的语法要求, 具体语法要求如下:
(1)要执行Update的表中, 建表时必须带有buckets(分桶)属性
(2)要执行Update的表中, 需要指定格式,目前只支持ORCFileformat和AcidOutputFormat,其余格式目前赞不支持, 如:parquet格式,textFile格式,
(3)要执行Update的表中, 建表时必须指定参数(‘transactional’ = true);

参考文献

HIVE行级更新操作配置

原创不易
转载请标明出处
如果对你有所帮助 别忘啦点赞支持哈
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/T_Y_F_/article/details/128962259