Reputation: 627
I have table name 'records' with desc:
hive> desc records;
OK
year string
temperature int
quality int
As per Apache documentation update is possible in Hive 1.2.1(versiona after 0.14.0)
I tried update command and got the error mentioned below :
hive> update records
> set quality=8
> where year='2000';
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.
What exactly I am missing? Is it code or does table is not meeting any condition (limitation)?
Upvotes: 0
Views: 3625
Reputation: 153
Update is allowed for ORC file formats only. Also you have to set few properties before performing the update or delete.
set hive.support.concurrency=true;
set hive.enforce.bucketing=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
set hive.compactor.initiator.on=true;
set hive.compactor.worker.threads=1;
After setting this create the table with required properties
CREATE TABLE test_result
(run_id VARCHAR(100), chnl_txt_map_key INT)
clustered by (run_id) into 1 buckets
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
STORED AS orc tblproperties ("transactional"="true" );
Now you can perform update or insert for this table. If you want the DML operations to be performed only on adhoc basis, you can set all the above properties in your session alone instead of setting the server side properties in hive-site.xml file.
Upvotes: 1
Reputation: 1200
add in hive-site.xml the following property,
<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>
<property>
<name>hive.compactor.worker.threads</name>
<value>1</value>
</property>
and restart hive server
check this link -> http://sanjivblogs.blogspot.in/2014/12/transactions-are-available-in-hive-014.html hope this helps
Upvotes: 0