Time for action – inserting the UFO data
Now that we have created a table, let us load the UFO data into it.
Copy the UFO data file onto HDFS:
$ hadoop fs -put ufo.tsv /tmp/ufo.tsv
Confirm that the file was copied:
$ hadoop fs -ls /tmp
You will receive the following response:
Found 2 items drwxrwxr-x - hadoop supergroup 0 … 14:52 /tmp/hive-hadoop -rw-r--r-- 3 hadoop supergroup 75342464 2012-03-03 16:01 /tmp/ufo.tsv
Enter the Hive interactive shell:
$ hive
Load the data from the previously copied file into the
ufodata
table:hive> LOAD DATA INPATH '/tmp/ufo.tsv' OVERWRITE INTO TABLE ufodata;
You will receive the following response:
Loading data to table default.ufodata Deleted hdfs://head:9000/user/hive/warehouse/ufodata OK Time taken: 5.494 seconds
Exit the Hive shell:
hive> quit;
Check the location from which we copied the data file:
$ hadoop fs -ls /tmp
You will receive the following response:
Found 1 items drwxrwxr-x - hadoop supergroup 0 … 16:10 /tmp/hive...