11.把文本文件的数据导入到Hive表中


先在hive里面创建一个表

create table  mydb2.t3(id int,name string,age int) row format delimited fields terminated by ','stored as textfile;

 

接下来创建数据文件

 

 把本地的数据文件导入到hive表中

LOAD DATA LOCAL INPATH '/opt/datas/a.txt' OVERWRITE INTO  TABLE  t3;

 

 

 

 

 接下来把hdfs上的文件导入到hive表中

现在在hdfs上创建目录,并把本地文件上传到hdfs

 

 

 

 在hive再创建一个表tt

create table  mydb2.tt(id int,name string,age int) row format delimited fields terminated by ','stored as textfile;

 

 

 把hdfs上的文件导入到hive的tt表里面

LOAD DATA  INPATH '/home/hadoop/testhive/a.txt' OVERWRITE INTO  TABLE  tt;

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM