【问题标题】:HIVE 1.x ACID features - Update and DELETE are not workingHIVE 1.x ACID 功能 - 更新和删除不起作用
【发布时间】:2015-08-05 19:15:14
【问题描述】:

作为 HIVE 1.x ACID 功能的一部分,更新和删除应该适用于 ORC 文件表(我在 Cloudera CDH 5.4.4 中尝试这样做)

但是,我发现它不起作用。有人可以建议。 错误:

失败:SemanticException [错误 10294]:尝试进行更新或 使用不支持这些的事务管理器删除 操作。

这是我创建的表

create table table2_test (EmployeeID Int, FirstName String, Designation String,
Salary Int,Department String) 
clustered by (department) into 3 buckets 
stored as orc TBLPROPERTIES ('transactional'='true');

CLI 提示:

    > set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
hive> set hive.compactor.initiator.on=true;
hive> set hive.compactor.worker.threads=1;
hive> set hive.support.concurrency=true;
hive> set hive.enforce.bucketing=true;
hive> set hive.exec.dynamic.partition.mode=nonstrict;
hive> Insert into table2_test values (102, 'Employee102','Designation102', 10101, 'Dept102'), (103, 'Employee103','Designation103', 10102, 'Dept103');
...........
Stage-Stage-1: Map: 1  Reduce: 3   Cumulative CPU: 9.14 sec   HDFS Read: 15568 HDFS Write: 1323 SUCCESS
Total MapReduce CPU Time Spent: 9 seconds 140 msec
OK
Time taken: 48.727 seconds
hive> update table2_test set salary=111111 where employeeid=20;
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.
hive> delete from table2_test where employeeid=19;
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.

【问题讨论】:

    标签: hadoop hive cloudera hiveql


    【解决方案1】:

    配置似乎没问题,但是您正在按部门和更新子句对表进行分桶,在 where 条件下,您使用的是未分桶的员工 ID。据我所知,表必须与 where 条件中使用的列一起存储,以进行更新、删除等酸性操作。你可以这样试一试:

    hive> update table2_test set salary=111111 where department=2;
    

    您还可以使用employeeid 上的存储桶重新创建表,并使用与示例中相同的查询。

    看看这个example

    【讨论】:

      猜你喜欢
      • 2020-02-02
      • 1970-01-01
      • 2018-07-17
      • 2018-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多