HiveQL INSERT Statement
Jump to navigation
Jump to search
A HiveQL INSERT Statement is a SQL INSERT Statement expressed in HiveQL.
- Context:
- It can be embedded in a HiveQL CREATE TABLE Statement.
- …
- Example(s):
INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT a.* FROM invites a WHERE a.ds='2008-08-15';
INSERT OVERWRITE LOCAL DIRECTORY '/tmp/local_out' SELECT a.* FROM pokes a;
INSERT INTO TABLE tablename PARTITION (partcol1[=val1], partcol2[=val2] ...) HiveQL SELECT statement;
INSERT OVERWRITE TABLE tablename_new PARTITION (part_col= 1381269306) SELECT col1,col2,col3 FROM tablename_old WHERE part_col = 1381269306 ;
- Counter-Example(s):
- a HiveQL LOAD Data Statement, such as
LOAD DATA LOCAL INPATH 'file.tsv' INTO TABLE tablename ;
- HiveQL UPDATE Statement.
- HiveQL DELETE Statement.
- HiveQL CREATE TABLE Statement.
- MySQL INSERT Statement.
- a HiveQL LOAD Data Statement, such as
- See: HiveQL DML.
References
2013
- https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-InsertingdataintoHiveTablesfromqueries
- Standard syntax:
INSERT OVERWRITE TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...) [IF NOT EXISTS]] select_statement1 FROM from_statement;
INSERT INTO TABLE tablename1 [PARTITION (partcol1=val1, partcol2=val2 ...)] select_statement1 FROM from_statement;
- Standard syntax: