1 Hive操作
1.1 创建数据库
create database if not exists myhive;
use myhive;
1.2 创建表
row format delimited fields terminated by ',':指定字段之间的分隔符
stored as textfile:指定文件存储格式
create table if not exists test(XXX int,XXX string) row format delimited fields terminated by ',' stored as textfile;
1.3 导入txt文件到表
load data local inpath '/test.txt' into table test;
1.4 查询结果并保存
1.4.1 导出到本地
insert overwrite local directory "/test/out/" row format delimited fields terminated by " " select * from test;
1.4.2 导出到hdfs
insert overwrite directory "/test/out/" row format delimited fields terminated by " " select * from test;