首页 > 解决方案 > Hive Beeline 使用 ACID 事务管理器

问题描述

我正在尝试使用直线运行此命令。

create table <table_1> like <table_2>

但似乎我的 Hive 配置为在 ACID 模式下运行。所以这个查询失败了

错误:编译语句时出错:失败:SemanticException [错误 10265]:在具有非 ACID 事务管理器的 ACID 表上不允许使用此命令。失败的命令:创建表(状态=42000,代码=10265)

在不更改任何全局配置的情况下,使用 ACID 事务管理器运行直线查询的正确语法是什么?

我的直线命令是:

beeline -u <jdbc_con> -e "create table <table_1> like <table_2>";

我想我应该使用类似的东西

hive>set hive.support.concurrency = true;
hive>set hive.enforce.bucketing = true;
hive>set hive.exec.dynamic.partition.mode = nonstrict;
hive>set hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
hive>set hive.compactor.initiator.on = true;
hive>set hive.compactor.worker.threads = a positive number on at least one instance of the Thrift metastore service;

但是我应该如何将它包含在直线中?当我尝试

beeline -u $jdbc_con -e "set hive.support.concurrency = true; create table <table_1>_test like <table_2>";

似乎不可能以这种方式更改这些参数。

错误:处理语句时出错:无法在运行时修改 hive.support.concurrency。它不在允许在运行时修改的参数列表中(状态=42000,代码=1)

感谢您的任何帮助。

标签: hivehortonworks-data-platformbeeline

解决方案


您可以设置配置单元属性并从直线运行配置单元查询,如下所示:

beeline -u $jdbc_con \
--hiveconf "hive.support.concurrency=true" \
--hiveconf "hive.enforce.bucketing=true" \
-e "create table <table_1>_test like <table_2>"

希望这会有所帮助。


推荐阅读