0
votes

In hive 0.14,i have a table with ACID supported transaction.

create table HiveTest 
(EmployeeID Int,FirstName String,Designation String,
Salary Int,Department String) 
clustered by (department) into 3 buckets 
stored as orc TBLPROPERTIES ('transactional'='true');

OK.i can insert data in this table:

from stagingtbl 
insert into table HiveTest 
select employeeid,firstname,designation,salary,department;

But if i not use buckets with this table:

create table HiveTest 
(EmployeeID Int,FirstName String,Designation String,
Salary Int,Department String)  
stored as orc TBLPROPERTIES ('transactional'='true');

I will get error when insert data:tables not bucketed.

So we must create a table with buckets in ACID transaction support to insert data?
Can we have any other ways to insert data in a ACID suppported table?

2

2 Answers

3
votes

As the Limitations section in Hive Transactions states:

  • BEGIN, COMMIT, and ROLLBACK are not yet supported. All language operations are auto-commit. The plan is to support these in a future release.
  • Only ORC file format is supported in this first release. The feature has been built such that transactions can be used by any storage format that can determine how updates or deletes apply to base records (basically, that has an explicit or implicit row id), but so far the integration work has only been done for ORC.
  • By default transactions are configured to be off. See the Configuration section below for a discussion of which values need to be set to configure it.
  • Tables must be bucketed to make use of these features. Tables in the same system not using transactions and ACID do not need to be bucketed.
  • At this time only snapshot level isolation is supported. When a given query starts it will be provided with a consistent snapshot of the data. There is no support for dirty read, read committed, repeatable read, or serializable. With the introduction of BEGIN the intention is to support snapshot isolation for the duration of transaction rather than just a single query. Other isolation levels may be added depending on user requests.
  • The existing ZooKeeper and in-memory lock managers are not compatible with transactions. There is no intention to address this issue. See Basic Design below for a discussion of how locks are stored for transactions.
0
votes

Which Version of the Hive you are using ? Hive 0.13 Supports Transaction properties but partially as Atomicity , Consistency and Durabalility but not Isolation. Hive 0.14 Supports but only only on bucketed tables and Table should be stored as ORC formatted. Make Sure you configure your hive-site.xml in HIVE_HOME to support concurrency and dynamic partitions and rest other properties.