hive语句
nohup hiveserjpsver2 >/dev/null 2>&1 & 将hive转为后台运行
beeline -u jdbc:hive2://192.168.181.166:10000 hive通过beeline连接
创建数据库
create database kb08
创建表(内表)
create table shop(
shop BIGINT,
shopname STRING,
running BOOLEAN,
contact ARRAY<STRING>,
address STRUCT<province:STRING,city:STRING,district:STRING,detail:STRING>,
yearlyMoney MAP<STRING,FLOAT>
)
row format delimited
fields terminated by '|'
collection items terminated by ':'
map keys terminated by ','
lines terminated by '\n'
location '/opt/bigdata/hadoop/hive110/warehouse/kb08/shop'
;
映射数据
首先将数据文件通过xftp上传到指定目录
load data local inpath '/root/shop.txt' into table shop;
注意:将数据类型大写,同时需要解析数据格式
有的则需要了解其asiii
例如:row format delimited
fields terminated by '\040';
040为空格的asiii