先在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;

