Monday, March 30, 2015

Simplest Hive command to make table


create external table c(line STRING) ROW FORMAT DELIMITED LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/user/root/';

create b.txt with some lines in it

hadoop fs -copyFromLocal b.txt /user/root. Don't need specify file names in Hive directory. 

hive> create external table c(line STRING) ROW FORMAT DELIMITED LINES TERMINATED BY '\n' STORED AS TEXTFILE LOCATION '/user/root/';
OK
Time taken: 0.282 seconds
hive> select * from c;
OK
this is the first line
this is the second line
third line 
no more lines

Time taken: 0.395 seconds, Fetched: 5 row(s)
hive> 

No comments:

Post a Comment