Apache Hive中默认的创建的表为非事务表,如果需要将表设置为事务表需要修改以下参数:
- <property>
- <name>hive.support.concurrencyname>
- <value>truevalue>
- property>
-
- <property>
- <name>hive.txn.managername>
- <value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManagervalue>
- property>
-
- <property>
- <name>hive.compactor.initiator.onname>
- <value>truevalue>
- property>
-
- <property>
- <name>hive.compactor.worker.threadsname>
- <value>1value>
- property>
-
- <property>
- <name>hive.create.as.insert.onlyname>
- <value>truevalue>
- property>
-
- <property>
- <name>hive.optimize.acid.meta.columnsname>
- <value>truevalue>
- property>
当表为事务表时,如果使用非事务的参数去执行SQL,会报如下错误:
Error: Error while compiling statement: FAILED: SemanticException [Error 10265]: This command is not allowed on an ACID table test_acid with a non-ACID transaction manager. Failed command: create table test_acid