在 HIVE 中删除一个 acid 表失败

问题描述

我试图在 HIVE 中删除一个 acid 表,但它抛出了这样的错误

无法获取表:java.lang.Exception:ErrorCode:InternalError, 消息:不启用酸表

DDL:

create table `test`( `id` string,`c1` string ) 
PARTITIONED BY (created_date date) CLUSTERED BY(id) INTO 6 BUCKETS 
STORED AS ORC TBLPROPERTIES (
    'orc.compress'='ZLIB','transactional'='true' );

那么我怎样才能删除这张桌子呢?

解决方法

在使用此类表之前,您需要正确设置 hive 事务管理器。请在 SQL 之前运行此命令以处理 ACID 表。
SET hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;

我使用的 SQL 如下 -

create table test( id string,c1 string ) PARTITIONED BY (created_date date) 
CLUSTERED BY(id) INTO 6 BUCKETS STORED AS ORC TBLPROPERTIES ( 'orc.compress'='ZLIB','transactional'='true' );

SET hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
insert into test partition(created_date) select 'a','b',current_date();
select * from test;

my result

要永久修复,您需要将以下条目添加到 hive-site.xml 文件中。

SET hive.support.concurrency=true;
SET hive.enforce.bucketing=true;
SET hive.exec.dynamic.partition.mode=nonstrict;

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...