CDH-hive内进行删除操作
hive安装后需要修改已建的表及查询操作,在执行修改操作时遇到了如下问题。
hive> update dp set name='beijing' where id=1159;
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.
1、在hive-site.xml文件中,增加如下属性。
hive.support.concurrency
true
hive.enforce.bucketing
true
hive.exec.dynamic.partition.mode
nonstrict
hive.txn.manager
org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
hive.compactor.initiator.on
true
hive.compactor.worker.threads
1
hive.in.test
true
2、重启hive服务;
3、表构建必须加上,否则无法进行删除操作
CLUSTERED BY (uniq_id) INTO 8 BUCKETS
STORED AS ORC TBLPROPERTIES ('transactional'='true'); 由于hive的删除只支持一个字句,因此要先设置好唯一健 delete from 表1 where 列1 in (select 列2 from 表2)
STORED AS ORC TBLPROPERTIES ('transactional'='true'); 由于hive的删除只支持一个字句,因此要先设置好唯一健 delete from 表1 where 列1 in (select 列2 from 表2)