首页 > 解决方案 > 在 HIVE 中删除酸表失败

问题描述

我试图在 HIVE 中删除一个酸表,它会引发如下错误:

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

DDL:</p>

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' );

那么我怎样才能放下这张桌子呢?

标签: hivehiveddl

解决方案


在使用此类表之前,您需要正确设置 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;

我的结果

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

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

推荐阅读