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 ...
Get Hadoop Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.