我正在对集群进行计算,最后当我使用 df.describe().show() 询问我的 Spark 数据帧的摘要统计信息时,我收到一个错误:
序列化任务 15:0 为 137500581 字节,超过了允许的最大值:spark.rpc.message.maxSize(134217728 字节)。考虑增加 spark.rpc.message.maxSize 或对大值使用广播变量
在我的 Spark 配置中,我已经尝试增加上述参数:
spark = (SparkSession
.builder
.appName("TV segmentation - dataprep for scoring")
.config("spark.executor.memory", "25G")
.config("spark.driver.memory", "40G")
.config("spark.dynamicAllocation.enabled", "true")
.config("spark.dynamicAllocation.maxExecutors", "12")
.config("spark.driver.maxResultSize", "3g")
.config("spark.kryoserializer.buffer.max.mb", "2047mb")
.config("spark.rpc.message.maxSize", "1000mb")
.getOrCreate())
我还尝试使用以下方法重新分区我的数据框:
dfscoring=dfscoring.repartition(100)
但我仍然不断收到同样的错误。
我的环境:Python 3.5、Anaconda 5.0、Spark 2
我怎样才能避免这个错误?