
# MetaStore动态分区数超出阈值导致SQL报错
#### 现象描述
执行SparkSQL或HiveSQL命令时，系统报错如下：
```
Number of dynamic partitions created is 2001, which is more than 2000. To solve this try to set hive.exec.max.dynamic.partitions to at least 2001
```
#### 原因分析
Hive中会默认限制最大动态分区数，由"hive.exec.max.dynamic.partitions"参数控制（默认值为1000）。 如果超过此限制，Hive将不会创建新的动态分区。
#### 处理步骤
- 调整上层业务，将动态分区数控制在"hive.exec.max.dynamic.partitions"参数值范围内。
- 执行**set hive.exec.max.dynamic.partitions =** *XXX* **;** 命令调大"hive.exec.max.dynamic.partitions"参数值。
  SparkSQL中需要设置"spark.hadoop.hive.exec.max.dynamic.partitions"参数。
  
 
