Support Questions

Find answers, ask questions, and share your expertise

Hive Multi Table insert extension questions

avatar
New Contributor

Hi all

 

Concerning the multi table insert extension the documentation says 

 

"The output of each of the select statements is written to the chosen table (or partition). Currently the OVERWRITE keyword is mandatory and implies that the contents of the chosen table or partition are replaced with the output of corresponding select statement."

 

But the syntax is showing that you can use an insert into instead of a mandatory OVERWRITE

 

FROM from_statement

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

[INSERT OVERWRITE TABLE tablename2 [PARTITION ... [IF NOT EXISTS]] select_statement2]

[INSERT INTO TABLE tablename2 [PARTITION ...] select_statement2] ...; FROM from_statement

INSERT INTO TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)] select_statement1

[INSERT INTO TABLE tablename2 [PARTITION ...] select_statement2]

[INSERT OVERWRITE TABLE tablename2 [PARTITION ... [IF NOT EXISTS]] select_statement2] ...;  

 

I'm currently using the insert into and it seems to work.

What documentation means with 'Currently the OVERWRITE keyword is mandatory'?

 

Another question concerns the Hive extension (dynamic partition inserts). Is this usable in the multi-table insert?

 

I'm using it and seems to work but I'm not sure that problems might arise in the future.

 

Regards   

2 REPLIES 2

avatar
Guru

@gambarno COuld you please point the document stating 'OVERWRITE keyword is mandatory"

avatar
New Contributor

In the hue help

 

  • Multiple insert clauses (also known as Multi Table Insert) can be specified in the same query.

  • The output of each of the select statements is written to the chosen table (or partition). Currently the OVERWRITE keyword is mandatory and implies that the contents of the chosen table or partition are replaced with the output of corresponding select statement.

 

Probably I'm misunderstanding something