问题描述
我试图在 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;
要永久修复,您需要将以下条目添加到 hive-site.xml 文件中。
SET hive.support.concurrency=true;
SET hive.enforce.bucketing=true;
SET hive.exec.dynamic.partition.mode=nonstrict;