Monday, June 12, 2017

Hive-loading data from hdfs

we can load data from hdfs to hive using load command

The default path of hdfs-->/user/cloudera/

The path of hive is -->/user/hive/warehouse/

we load data from hdfs to hive

syntax
------
load data inpath 'filepath' into table tablename;

ex:
load data inpath '/user/cloudera/file1' into table tab8;

cat> file1
1,2,3
4,5,6
7,7,9

$hadoop fs -copyFromLocal /home/cloudera/file1 /user/cloudera

hive> create table tab8(a int,b int,c int)
row format delimited fields terminated by ',';

hive>load data inpath '/user/cloudera/file1' into table tab8;

hive>select *from tab8;



























No comments: