hive的相关操作

hive分区视频资料:
hive的分区视频学习资料

1、hive表创建(生命周期1天、的外部表,扥分区名称是ds)

create external table test_external_location03 (
id string comment 'ID', 
name string comment '名字'
)
comment '测试外部表location'
PARTITIONED BY (ds string)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
location '/tmp/dkl/external_location'
lifecycle 1 ;
create external table test_external_location03 (
id string comment 'ID', 
name string comment '名字'
)
comment '测试外部表location'

#这个是正常的创建表语句,comment是解释和说明

PARTITIONED BY (ds string)
#表示分区

ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
#row类型的

location '/tmp/dkl/external_location'
#路径地址

create external table 
#以external 这个关键字声明创建的表就是外部表。
lifecycle 1 
#表示生命周期为1天

2、hive添加数据

#备注:测试过程中的坑,看网上帖子说 要进入到hive的外部路径下,写个txt文件,把内容push上去。
#这个不用这么弄啊
外部表和内部表加数据都是
insert into

INSERT INTO test_external_location03 PARTITION(ds='20211014') VALUES(14,'hhh'),(14,'hhh'),(14,'hhh'),(14,'hhh');

#这里ds='20211014' 这个是分区内容,要是创建的保持一致
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值