创建两个partition的hive表

本文介绍了如何使用Hive创建带有两个分区字段的表,并展示了针对特定日期的数据分区情况。通过具体命令示例,读者可以了解到如何创建外部表并指定其存储格式及输入输出格式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、创建两个partition的hive表

CREATE EXTERNAL TABLE t_result_analysis_web_stat(
appid int,
type string,
key string,
statdate string,
uv string,
pv string,
extra string)
PARTITIONED BY (
datecol string,identify string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat';


2、结果

18:58 [yule@a002.client.hadoop.qingdao.youku]$ hadoop fs -ls /warehouse/hive/warehouse/ent.db/t_result_analysis_web_stat/datecol=2014-11-23
Found 4 items
drwxr-xr-x - yule entlog 0 2014-11-24 18:34 /warehouse/hive/warehouse/ent.db/t_result_analysis_web_stat/datecol=2014-11-23/identify=city
drwxr-xr-x - yule hadoop 0 2014-11-24 18:24 /warehouse/hive/warehouse/ent.db/t_result_analysis_web_stat/datecol=2014-11-23/identify=ip
drwxr-xr-x - yule entlog 0 2014-11-24 18:39 /warehouse/hive/warehouse/ent.db/t_result_analysis_web_stat/datecol=2014-11-23/identify=isp
drwxr-xr-x - yule entlog 0 2014-11-24 18:29 /warehouse/hive/warehouse/ent.db/t_result_analysis_web_stat/datecol=2014-11-23/identify=province
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值