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'; -- 行分隔符