无法更改Spark中的hive.exec.max.dynamic.partitions

Gog*_*ogu 6 hive apache-spark

我试图在一个有1500个动态分区的表中插入一些数据,我收到此错误:

 Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
 Number of dynamic partitions created is 1500, which is more than 1000. 
 To solve this try to set hive.exec.max.dynamic.partitions to at least 1500.
Run Code Online (Sandbox Code Playgroud)

所以,我试着:SET hive.exec.max.dynamic.partitions=2048但我仍然得到同样的错误.

如何从Spark更改此值?

码:

this.spark.sql("SET hive.exec.dynamic.partition=true")
this.spark.sql("set hive.exec.dynamic.partition.mode=nonstrict")
this.spark.sql("SET hive.exec.max.dynamic.partitions=2048")
this.spark.sql(
    """
      |INSERT INTO processed_data
      |PARTITION(event, date)
      |SELECT c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,event,date FROM csv_data DISTRIBUTE BY event, date
    """.stripMargin
).show()
Run Code Online (Sandbox Code Playgroud)

使用Spark 2.0.0独立模式.谢谢!

Vin*_*udi 4

从 Spark 2.x 版本开始,在Spark CLI中添加 Hive 设置属性可能不起作用。请将您的 hive 设置属性添加到Spark 和 hive conf 目录的hive-site.xml中。

在hive-site.xml文件中添加以下属性应该可以解决您的问题。

<name>hive.exec.max.dynamic.partitions</name>
<value>2048</value>
<description></description>
Run Code Online (Sandbox Code Playgroud)

注意:如果不起作用,请重新启动 hiveserver2 和 Spark 历史记录服务器。