Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SemanticException [Error 10265] while running simple hive select query on a transactional hive table

I created the table in 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");

now trying to query using putty in hive prompt:

select * from test_db.test_table;

this fails with the below message:

FAILED: SemanticException [Error 10265]: This command is not allowed on an ACID table test_db.test_table with a non-ACID transaction manager. Failed command: null

Please help me with this error.

like image 438
osum Avatar asked Mar 08 '17 10:03

osum


People also ask

How can you tell if a table is transactional in hive?

Apache HiveIf you get an output with the string that you grep for, then the table is transactional.

What is acid transactions in hive?

Hive ACID transactions enable atomicity of operations at the row level, which allows a Hive client to read from a partition or table and simultaneously, another Hive client can add rows to the same partition or table.


1 Answers

Hive transaction manager must be set to org.apache.hadoop.hive.ql.lockmgr.DbTxnManager in order to work with ACID tables.

SET hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;

Additionally, Set these properties to turn on transaction support

Client Side

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

Server Side (Metastore)

SET hive.compactor.initiator.on=true;
SET hive.compactor.worker.threads=1;

Note: Add these properties in hive-site.xml to set them permanently.

like image 151
franklinsijo Avatar answered Oct 08 '22 20:10

franklinsijo