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