Hive使用update&delete操做

1.修改配置(hive-site.xml)也能夠直接加入hive開頭給予變量apache

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

2.重啓metastore服務oop

service hive-metastore restart

3.注意,update/delete 操做對錶有限制須要分桶。rest

hive>create table test(id int ,name string )clustered by (id) into 2 buckets stored as orc TBLPROPERTIES('transactional'='true');
hive>insert into table test values (1,'row1'),(2,'row2'),(3,'row3');
hive>delete from test where id = 1;
hive>update test set name = 'ucloud' where id = 2;
相關文章
相關標籤/搜索