Created
January 28, 2016 14:39
-
-
Save thanoojgithub/ef983c6c0b6d1a7589da to your computer and use it in GitHub Desktop.
EXPORT query result into a directory in Hive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hive> INSERT OVERWRITE LOCAL DIRECTORY '/home/ubuntu/input/raw' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' select * from raw; | |
Query ID = ubuntu_20160128195617_0b1801f7-00eb-4b61-b8ac-4e190a6a00a5 | |
Total jobs = 1 | |
Launching Job 1 out of 1 | |
Number of reduce tasks is set to 0 since there's no reduce operator | |
Starting Job = job_1453963805097_0040, Tracking URL = http://ubuntu:8088/proxy/application_1453963805097_0040/ | |
Kill Command = /usr/local/hadoop2/bin/hadoop job -kill job_1453963805097_0040 | |
Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0 | |
2016-01-28 19:56:24,017 Stage-1 map = 0%, reduce = 0% | |
2016-01-28 19:56:29,416 Stage-1 map = 100%, reduce = 0%, Cumulative CPU 0.7 sec | |
MapReduce Total cumulative CPU time: 700 msec | |
Ended Job = job_1453963805097_0040 | |
Copying data to local directory /home/ubuntu/input/raw | |
Copying data to local directory /home/ubuntu/input/raw | |
MapReduce Jobs Launched: | |
Stage-Stage-1: Map: 1 Cumulative CPU: 0.7 sec HDFS Read: 3243 HDFS Write: 131 SUCCESS | |
Total MapReduce CPU Time Spent: 700 msec | |
OK | |
raw.id raw.name raw.dt | |
Time taken: 13.308 seconds | |
hive> LOAD DATA LOCAL INPATH '/home/ubuntu/input/raw/000000_0' OVERWRITE INTO TABLE raw_ext; | |
Loading data to table thanooj.raw_ext | |
Table thanooj.raw_ext stats: [numFiles=0, numRows=0, totalSize=0, rawDataSize=0] | |
OK | |
Time taken: 0.206 seconds | |
hive> select * from raw_ext; | |
OK | |
raw_ext.id raw_ext.name raw_ext.dt | |
1 sriram 2015-10-12 | |
2 seetamma 2015-09-12 | |
3 lakshmana 2015-11-12 | |
4 bharatha 2015-12-12 | |
5 Shatrughna 2015-12-12 | |
6 hanuma 2015-11-12 | |
Time taken: 0.047 seconds, Fetched: 6 row(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment