如何将“spark.sql.shuffle.partitions”设置为自动

Ano*_*ous 5 apache-spark apache-spark-sql pyspark azure-databricks

我的要求是设置spark.sql.shuffle.partitions=auto

但是我在运行以下代码时收到以下错误

%python
spark.conf.set("spark.sql.shuffle.partitions=auto")
Run Code Online (Sandbox Code Playgroud)
error 
TypeError                                 Traceback (most recent call last)
<command-3238694083679317> in <cell line: 1>()
----> 1 spark.conf.set("spark.sql.shuffle.partitions=auto")

TypeError: set() missing 1 required positional argument: 'value'
Run Code Online (Sandbox Code Playgroud)

Ano*_*ous 6

下面给出解决方案。

spark.conf.set("spark.sql.shuffle.partitions","auto")
Run Code Online (Sandbox Code Playgroud)

上面的代码将随机播放分区设置为“自动”。

通过下面的代码,我们可以看到随机分区值。

spark.conf.get("spark.sql.shuffle.partitions")
Run Code Online (Sandbox Code Playgroud)