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;
相关文章
相关标签/搜索