zoukankan      html  css  js  c++  java
  • hive update和delete报错Attempt to do update or delete using transaction manager

    默认在hive中没有默认开启支持单条插入(update)、更新以及删除(delete)操作,需要自己配置。而在默认情况下,当用户如果使用update和delete操作时,会出现如下情况:

    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.

       以下是开启update与delete功能的步骤梳理:
    1、在hive-site.xml文件中,增加如下属性。

        <name>hive.support.concurrency</name>
        <value>true</value>

        <name>hive.enforce.bucketing</name>
        <value>true</value>

        <name>hive.exec.dynamic.partition.mode</name>
        <value>nonstrict</value>

        <name>hive.txn.manager</name>
        <value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value>

        <name>hive.compactor.initiator.on</name>
        <value>true</value>

        <name>hive.compactor.worker.threads</name>
        <value>1</value>

        <name>hive.in.test</name>
        <value>true</value>

    2、重启hive服务;

    3、创建表;
    create table student(
      id int,
      name String,
      sex varchar(2),
      birthday varchar(10),
      major varchar(1)
    )clustered by (id) into 2 buckets stored as orc TBLPROPERTIES('transactional'='true');

    4、测试update,delete语句
    hive> update student set name='beijing' where id=1159;

         修改成功。可以成功执行update与delete。频繁的update和delete操作已经违背了hive的初衷。不到万不得已的情况,还是使用增量添加的方式最好。


    参考:
    开启hive数据表的update delete 
    http://blog.csdn.net/suijiarui/article/details/51174406

    CDH版本hive增加Update、Delete支持
    http://www.cnblogs.com/kekukekro/p/6340974.html

    hive0.14-insert、update、delete操作测试
    http://blog.csdn.net/hi_box/article/details/40820341

     转自:https://blog.csdn.net/victorzzzz/article/details/81772836

  • 相关阅读:
    “XXXXX” is damaged and can’t be opened. You should move it to the Trash 解决方案
    深入浅出 eBPF 安全项目 Tracee
    Unity3d开发的知名大型游戏案例
    Unity 3D 拥有强大的编辑界面
    Unity 3D物理引擎详解
    Unity 3D图形用户界面及常用控件
    Unity 3D的视图与相应的基础操作方法
    Unity Technologies 公司开发的三维游戏制作引擎——Unity 3D
    重学计算机
    windows cmd用户操作,添加,设备管理员组,允许修改密码
  • 原文地址:https://www.cnblogs.com/javalinux/p/14866165.html
Copyright © 2011-2022 走看看