Hive中的CRUD操作 [英] CRUD operations in Hive
问题描述
我试图在Hive中执行CRUD操作,并且能够成功运行插入查询,但是当我尝试运行更新并删除以下异常时。
$ b FAILED:SemanticException [错误10294]:尝试使用不支持这些操作的事务管理器进行更新或删除。
我跑过的查询列表
CREATE TABLE students(name VARCHAR(64) ,年龄INT,gpa DECIMAL(3,2))
按(年龄)分组到2个存储为ORC的桶中;
INSERT INTO TABLE学生
VALUES('fred flintstone',35,1.28),('barney碎石',32,2.32);
CREATE TABLE pageviews(userid VARCHAR(64),链接STRING,came_from STRING)
PARADTIONED BY(datestamp STRING)CLUSTERED BY(userid)INTO 256 BUCKETS STORED 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'),('tree ','finance.com',null,'2014-09-21');
来源: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Delete
更新和删除我正在运行的查询
update students1 set age = 36 where name ='barney碎石';
更新students1 set name ='barney refble1'where age = 36;
从学生1删除,其中年龄= 32;
Hive版本:2.1(最新)
b 注意:我知道Hive不是用于更新和删除命令(在BigData集合上)仍然试图做的,以获得对Hive CRUD操作的了解。 p>
有人可以指出/指引我在哪里更新/删除查询时出错。
我在Hive 1.1.0 CDH 5.8.3中测试过,它正在运行。您在评论中提供的相同示例
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.
make sure you are setting the properties listed here.
I tested in Hive 1.1.0 CDH 5.8.3 and it is working. same exampled you provided in your comment
这篇关于Hive中的CRUD操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!