hive分区表

​1. hive创建分区表

create external table if not exists table1(
col1 string,
col2 string)
partitioned by (state string,country string)
row format delimited fields terminated by ',' store as ORC;

2. 分区表中插入数据
2.1. 静态分区表
静态分区表在向表中插入数据时要指定对应分区

INSERT OVERWRITE table1 (state='Asia', month='China'SELECT col1, col2 
FROM table2;

2.2 动静结合分区表
启动动态分区功能
set hive.exec.dynamic.partition=true;
设置动态分区表中至少有一个分区为静态分区
set hive.exec.dynamic.partition.mode=strick;

INSERT OVERWRITE table1(state='Asia', country)
SELECTcol1, col2
FROM table2;

2.3. 完全动态分区表
启动动态分区功能
set hive.exec.dynamic.partition=true;
允许全部分区都是动态分区
set hive.exec.dynamic.partition.mode=nostrick;

INSERT OVERWRITE table1(state, country)
SELECT col1, col2
FROM table2;

3.分区表相关参数

set hive.exec.max.dynamic.partitions.pernode=100
–每个maper或reducer可以允许创建的最大动态分区个数,默认是100

set hive.exec.max.dynamic.partitions =1000
–动态分区的上限,默认1000

set hive.exec.max.created.files =10000
–一个mapreduce作业能创建的HDFS文件最大数,默认是100000

<property>
    <name>dfs.datanode.max.xcievers</name>
    <value>8192</value>
</property>

–控制DataNode一次可以打开的文件个数
–这个参数必须设置在DataNode的$HADOOP_HOME/conf/hdfs-site.xml文件中

听说关注过这个微信公众号的同学都找到了对象

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值