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.
Similar Posts:
- Hive initialization metadata error [How to Solve]
- With check option in SQL
- Kingbasees supports column encryption
- [Solved] spark Connect hive Error: javax.jdo.JDODataStoreException: Required table missing : “`DBS`” in Catalog “” Schema “”
- In Oracle, an error is reported: ora-00904
- [Solved] CDP7.1.7 Install hive on tez Error: Can’t create directory /mnt/ssd/yarn/nm/usercache/urika/appcache/application_1424508393097_0004 – Permission denied
- [Solved] Pycharm Error: TypeError: init() missing 1 required positional argument: ‘on_delete’
- How to Use delimiter// to solve MySQL end error
- mysql: [Err] 1075 – Incorrect table definition; there can be only one auto column and it must be d…
- User xxx does not have privileges for CREATETABLE [How to Solve]