在事务配置单元表上运行简单配置单元选择查询时出现SemanticException [错误10265]

osu*_*sum 6 database hive hiveql

我在hive中创建了表:

CREATE TABLE test_table (COL1 string, COL2 string, COL3 string, COL4 string) CLUSTERED BY(COL2) INTO 4 BUCKETS STORED AS ORC tblproperties("transactional"="true");
Run Code Online (Sandbox Code Playgroud)

现在尝试在hive提示符中使用putty进行查询:

select * from test_db.test_table;
Run Code Online (Sandbox Code Playgroud)

这失败了以下消息:

FAILED:SemanticException [错误10265]:在具有非ACID事务管理器的ACID表test_db.test_table上不允许此命令.命令失败:null

请帮我解决这个错误.

fra*_*ijo 12

必须将Hive事务管理器设置为org.apache.hadoop.hive.ql.lockmgr.DbTxnManager使用ACID表.

SET hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
Run Code Online (Sandbox Code Playgroud)

此外,设置这些属性以打开事务支持

客户端

SET hive.support.concurrency=true;
SET hive.enforce.bucketing=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
Run Code Online (Sandbox Code Playgroud)

服务器端(Metastore)

SET hive.compactor.initiator.on=true;
SET hive.compactor.worker.threads=1;
Run Code Online (Sandbox Code Playgroud)

注意:添加这些属性hive-site.xml以永久设置它们.