How to specify a list of columns in a bush insert in a query

I just installed and configured Apache Hive version 1.1.0. Then I created a table by querying this query:

create table person (name1 string, surname1 string);

And then I want to add one line:

insert into person (name1, surname1) values ("Alan", "Green");

And this causes an error:

Error: error compiling the statement: FAILED: line ParseException 1:20 could not recognize the input next to '(' 'name1' ',' in statement (Status = 42000, code = 40000).

But when I execute the query without a list of columns, it works fine:

insert into person values ("Alan", "Green");

Question: how to specify a list of columns in hiveQL to insert in?

+4
source share
4 answers

Currently, the hive does not support such functionality, details here

.

+2

:

insert into table person (name1, surname1) values ("Alan", "Green");

Hive 2.0

+2

HIVE-9481 INSERT, 1.2.0. :

INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...) 
[(column_list)]
[IF NOT EXISTS]] select_statement1 FROM from_statement;

:

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

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

Hive 2.1. INSERT INTO, INSERT OVERWRITE

, - Apache LanguageManual DML

https://issues.apache.org/jira/browse/HIVE-9481

+1

Hive , .

hive. . .

Temporary solutions exist for performing insertions / updates and deletions in the hive. But this is not recommended.

0
source

All Articles