Hive ACID
要实现update和delete功能,该表就必须支持ACID,而支持ACID,就必须满足以下条件:
表的存储格式必须是ORC(STORED AS ORC);
表必须进行分桶(CLUSTERED BY (col_name, col_name, …) INTO num_buckets BUCKETS);
Table property中参数transactional必须设定为True(tblproperties(‘transactional’=‘true’));
Hive使用update和delete中有两种常见报错
报错一:Attempt to do update or delete using transaction manager that does not support these operations.
报错二:Attempt to do update or delete on table liuli.cars that does not use an AcidOutputFormat or is not bucketed
报错一解决方案:配置hive-site.xml
服务端
hive-site.xml 的 Hive 服务高级配置代码段(安全阀)
hive.compactor.initiator.on – true
hive.compactor.worker.threads – 1</