HiveQL LOAD DATA Statement
(Redirected from HiveQL LOAD Data Statement)
Jump to navigation
Jump to search
A HiveQL LOAD DATA Statement is a data load statement expressed in HiveQL.
- Context:
- It can be embedded in a HiveQL CREATE TABLE Statement.
- …
- Example(s):
LOAD DATA LOCAL INPATH '/tmp/local-file.tsv' INTO TABLE tablename ;
LOAD DATA INPATH 'hdfs-file' OVERWRITE INTO TABLE tablename PARTITION (partcol1=value1, partcol2=value2);
- Counter-Example(s):
- See: HiveQL DML.
References
2013
- https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-DMLOperations
- Loads a file that contains two columns separated by ctrl-a into pokes table. 'LOCAL' signifies that the input file is on the local file system. If 'LOCAL' is omitted then it looks for the file in HDFS.
The keyword 'OVERWRITE' signifies that existing data in the table is deleted. If the 'OVERWRITE' keyword is omitted, data files are appended to existing data sets.
NOTES:
- NO verification of data against the schema is performed by the load command.
- If the file is in hdfs, it is moved into the Hive-controlled file system namespace. The root of the Hive directory is specified by the option hive.metastore.warehouse.dir in hive-default.xml. We advise users to create this directory before trying to create tables via Hive.
- Loads a file that contains two columns separated by ctrl-a into pokes table. 'LOCAL' signifies that the input file is on the local file system. If 'LOCAL' is omitted then it looks for the file in HDFS.
- https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DML#LanguageManualDML-Syntax
LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)]