By default, there is no default support for single insert (update), update and delete (delete) operations in hive, you need to configure it yourself. And by default, when a user uses the update and delete operations, the following happens.
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.
The following is a step-by-step guide to enable the update and delete functions.
1. In the hive-site.xml file, add the following attributes.
<name>hive.support.concurrency</name>
<value>true</value
<name>hive.force.bucketing</name
<value>true</value>
<name>hive.exec.dynamic.partition.mode</name
<value>nonstrict</value>
<name>hive.txn.manager</name>
<value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value>
<name>hive.compactor.initiator.on</name
<value>true</value>
<name>hive.compactor.worker.threads</name
<value>1</value>
<name>hive.in.test</name
<value>true</value>
2. restarting the hive service.
3. Create the table.
create table student(
id int,
name String,
sex varchar(2),
birthday varchar(10),
major varchar(1)
) clustered by (id) into 2 buckets stored as orc TBLPROPERTIES(‘transactional’=’true’);
4, test update, delete statement
hive> update student set name=’beijing’ where id=1159;
Modify successfully. The frequent update and delete operations have defeated the original purpose of hive. As a last resort, it is best to use the incremental add method.