0
votes

Hive loading:

How to use the below command to load data to hive table from the external server or remote machine. Usually this below statement will work from hadoop local edge node.

Load data local inpath 'local file system' overwrite into table hive_table

1

1 Answers

0
votes

Internally Hive works on a schema which is present in the HDFS, Create a location in HDFS and then move all your data into that HDFS location.

Now create a Hive table which will read/point to that location.

If it is any commercial distribution like Cloudera/HortonWorks then Apache Hue is your saviour.

If it is not a commercial distro please use scp protocol to create a hdfs file and then use the Hive syntax mentioned below:

hive> CREATE  TABLE `remote_file`(
    >   `Temperature` int, 
    >   `Year` string)
    > ROW FORMAT DELIMITED 
    >   FIELDS TERMINATED BY ',' 
    >   LINES TERMINATED BY '\n' 
    > LOCATION
    >   'hdfs:///tmp/remote_file';