0
votes

I'm trying to do CRUD operations in Hive and able to successfully run insert query however when I tried to run update and delete getting the below exception.

FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.

List of the queries I ran

CREATE TABLE students (name VARCHAR(64), age INT, gpa DECIMAL(3, 2))
  CLUSTERED BY (age) INTO 2 BUCKETS STORED AS ORC;

INSERT INTO TABLE students
  VALUES ('fred flintstone', 35, 1.28), ('barney rubble', 32, 2.32);


CREATE TABLE pageviews (userid VARCHAR(64), link STRING, came_from STRING)
  PARTITIONED BY (datestamp STRING) CLUSTERED BY (userid) INTO 256 BUCKETS STORED AS ORC;

INSERT INTO TABLE pageviews PARTITION (datestamp = '2014-09-23')
  VALUES ('jsmith', 'mail.com', 'sports.com'), ('jdoe', 'mail.com', null);

INSERT INTO TABLE pageviews PARTITION (datestamp)
  VALUES ('tjohnson', 'sports.com', 'finance.com', '2014-09-23'), ('tlee', 'finance.com', null, '2014-09-21');

Source : https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Delete

Update and delete queries I'm trying to run

update students1 set age = 36 where  name ='barney rubble';

update students1 set name = 'barney rubble1' where  age =36;

delete from students1 where age=32;

Hive Version : 2.1(Latest)

Note : I'm aware that Hive is not for Update and Delete commands(on BigData set) still trying to do, to get awareness on Hive CRUD operations.

Can someone point/guide me the where I'm going wrong on update/delete queries.

1
did you set the table property "transactional=true"? cwiki.apache.org/confluence/display/Hive/…yoga
I tried to create a new table by setting the transcational=true. This time insert is also not working CREATE TABLE students2 (name VARCHAR(64), age INT, gpa DECIMAL(3, 2)) CLUSTERED BY (age) INTO 2 BUCKETS STORED AS ORC TBLPROPERTIES("transactional"="true"); INSERT INTO TABLE students2 VALUES ('fred flintstone', 35, 1.28), ('barney rubble', 32, 2.32); FAILED: SemanticException [Error 10265]: This command is not allowed on an ACID table glx.students2 with a non-ACID transaction manager. Failed command: INSERT INTO TABLE students2 values (...)Ram

1 Answers

1
votes

make sure you are setting the properties listed here.

https://community.hortonworks.com/questions/37519/how-to-activate-acid-transactions-in-hive-within-h.html

I tested in Hive 1.1.0 CDH 5.8.3 and it is working. same exampled you provided in your comment