hive安装后需要修改已建的表及查询操作,在执行修改操作时遇到了如下问题。
 
hive> update dp set name='beijing' where id=1159;
FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.
 
1、在hive-site.xml文件中,增加如下属性。
<property>
    <name>hive.support.concurrency</name>
    <value>true</value>
  </property>
    <property>
    <name>hive.enforce.bucketing</name>
    <value>true</value>
  </property>
    <property>
    <name>hive.exec.dynamic.partition.mode</name>
    <value>nonstrict</value>
  </property>
  <property>
    <name>hive.txn.manager</name>
    <value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value>
  </property>
    <property>
    <name>hive.compactor.initiator.on</name>
    <value>true</value>
  </property>
  <property>
    <name>hive.compactor.worker.threads</name>
    <value>1</value>
  </property>
  <property>
    <name>hive.in.test</name>
    <value>true</value>
  </property>
 
2、重启hive服务;
3、表构建必须加上,否则无法进行删除操作
CLUSTERED BY (uniq_id) INTO 8 BUCKETS
STORED AS ORC TBLPROPERTIES ('transactional'='true');
 
由于hive的删除只支持一个字句,因此要先设置好唯一健
delete from 表1 where 列1 in (select 列2 from 表2)
 
posted on 2018-03-29 14:25  洛丹伦的雪  阅读(504)  评论(0编辑  收藏  举报