Since Hive has no row-level insert, update, and delete
operations, the only way to put data into a hive table is to use “bulk” load
operations. The following query can be used to load data from local file system
to the hive table stored in hdfs.
Query- Load
data local inpath ‘/home/training/src.txt’ into table tab11;
When it’s necessary to load the input file from an hdfs
location
Query- Load
data inpath ‘src.txt’ into table tab11;
Overwrite command can be used when the hive table already
holds data and to replace the existing values
Query- Load
data local inpath ‘/home/training/src.txt’ overwrite into table tab11;
Storing an output:-
The following query stores
the output in local directory by creating a folder “output”
in the specified path.
Query- Insert
overwrite local directory ‘/home/training/output’ select * from tab11;
The following query stores
the output of query in hdfs.
Query- Insert
overwrite directory ‘/output’ select * from tab11.
No comments:
Post a Comment