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

  • 相关阅读:
    Linux ,Ubuntu 分区建议大小
    [No000019A]【波浪理论精典教学课程】
    CS(计算机科学)知识体
    如何量化考核技术人的KPI?
    Linux系统的命令应该如何记?
    数学和物理太难?这些 GIF 让你秒懂抽象概念
    加密数字货币的 7 个致命悖论
    量子力学中,全体自然数之和是负十二分之一,物理意义是什么?
    30岁左右的人,来谈谈你犯了哪些错误?
    一篇文章学懂Shell脚本,最简明的教程在这里
  • 原文地址:https://www.cnblogs.com/javalinux/p/14866165.html
Copyright © 2011-2022 走看看