1.建表语句
create table temp.mg_order(
father_id string,
order_id string,
user_id string,
account string,
created_time timestamp,
pay_status string,
pay_time timestamp,
money double,
pay_type string,
mall string,
order_type string,
order_status string
)ROW format delimited fields terminated by'\t' STORED AS TEXTFILE
LOCATION
'/warehouse/tablespace/managed/hive/tmp/mg_order';
2.上传TXT文本到指定的location
3.加载指定路劲下的文件
load data inpath'/warehouse/tablespace/managed/hive/tmp/mg_order/' into table temp.mg_order;
4.select 数据

附hive建表分隔符
row format delimited fields terminated by ',' -- 列分隔符
collection items terminated by '_' -- MAP STRUCT 和 ARRAY 的分隔符(数据分割符号)
map keys terminated by ':' -- MAP中的key与value的分隔符
lines terminated by '\n'; -- 行分隔符
本文介绍了使用Hive进行大数据处理的步骤,包括创建表结构,上传TXT文本到指定目录,将文件加载到Hive表中,以及执行SQL查询数据。主要涉及的数据类型包括字符串、时间戳、双精度浮点数等,同时提到了Hive的字段和行分隔符设置。
2067

被折叠的 条评论
为什么被折叠?



