CDH Hive行级更新操作--实现update和delete
一、问题出现原因
在Hive表执行update和delete操作时,报如下错误:
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.
如图所示:
经过查阅资料发现,要实现update和delete操作,需要开启事务功能,详细见官网:https://cwiki.apache.org/confluence/display/Hive/Hive+Transactions#HiveTransactions-NewConfigurationParametersforTransactions
在Configuration配置有详细的操作,如图所示:
Minimally, these configuration parameters must be set appropriately to turn on transaction support in Hive:
Client Side
hive.support.concurrency – true
hive.enforce.bucketing – true (Not required as of Hive 2.0)
hive.exec.dynamic.partition.mode – nonstrict
hive.txn.manager – org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
Server Side (Metastore)
hive.compactor.initiator.on – true (See table below for more details)
hive.compactor.worker.threads – a positive number on at least one instance of the Thrift metastore