我经过“Programming Hive”编程后发现以下内容。
Hive offers no support for rowlevel
inserts, updates, and deletes. Hive doesn’t support transactions.
但是在CDH5上,我可以在表中添加一行。但是更新和删除将错误抛出为“语义错误”。我读到ACID属性可以在配置单元上设置,但不能正常工作。
Question : Can we update and delete a record in hive?
最佳答案
Hive不适用于OLTP,但现在它支持ACID操作,您必须为其更改一些配置。要尝试,请执行以下操作:
set hive.support.concurrency = true;
set hive.enforce.bucketing = true;
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode = nonstrict;
ACID交易(插入,更新和删除)
create table testTableNew(id int ,name string )
clustered by (id) into 2 buckets
stored as orc TBLPROPERTIES('transactional'='true');
insert into table testTableNew values (1,'row1'),(2,'row2'),(3,'row3');
update testTableNew set name = 'updateRow2' where id = 2;
delete from testTableNew where id = 1;
关于hadoop - 在Hive中更新和删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37802264/