hive&&beeline 数据导入导出
hive数据导入方式
1.从本地文件系统中导入数据到Hive表
echo "
create table test (id int, name string,age int, tel string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;
load data local inpath '/home/hadoop/add.txt' into table test;" | hive
注意:add.txt 字段分割符需要跟创建表字段的分割符一致
2.从HDFS上导入数据到Hive表
hadoop dfs -put /home/hadoop/add.txt /user/hive/add.txt
hive -e "load data inpath '/user/hive/add.txt' into table test;"
3.从别的表中查询出相应的数据并导入到Hive表中
echo "