hive建表读取TXT文本

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';                      -- 行分隔符
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值