Hive Partition 操作

本文介绍如何使用Hive创建Parquet格式的外部表,包括表结构定义、数据存储格式及分区操作等内容。此外还介绍了如何加载数据到指定分区。
create external table demo (userid int ,name string ,address string)
comment 'demo'
partitioned by (txdate string ,txhour string)
row format delimited fields terminated by '\t'
lines terminated by '\n' stored as parquet    //parquet 是采用列式存储的 sorted as textfile

如果创建的table 是 parquet 模式 那么 loclation 的 数据也需要时parquet 的 否则 就又问题了

增加partition 
alter table table_name add partition (name 1 = 1 ,name 2 = 3 ) location '///' 在已经存在的table 增加分区,跟db2 一样 事先增加分区
此处的location 不是必须的 ,但是想创建分区的时候 同时导入数据这么加上location 是没有问题的 

load data local inpath '' into  table table_name partition() 



转载于:https://www.cnblogs.com/TendToBigData/p/10501270.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值