【问题标题】:Total size of serialized results of n tasks (x MB) is bigger than spark.driver.maxResultSizen 个任务的序列化结果的总大小 (x MB) 大于 spark.driver.maxResultSize
【发布时间】:2020-08-16 00:20:30
【问题描述】:

我在对 spark 数据帧执行简单计数操作时遇到以下错误。

org.apache.spark.SparkException: Job aborted due to stage failure: Total size of serialized results of 4778 tasks (1024.3 MB) is bigger than spark.driver.maxResultSize (1024.0 MB)

设置:

master : yarn-client
spark.driver.memory : 4g
spark.driver.maxResultSize : 1g
spark.executor.cores : 2
spark.executor.memory :  7g
spark.executor.memoryOverhead : 1g
spark.yarn.am.cores : 1
spark.yarn.am.memory : 3g
spark.yarn.am.memoryOverhead : 1g

我不确定为什么这段简单的代码会向驱动程序发送超过 1 GB 的数据。理想情况下,整个计算应该在执行器中进行,并且只有结果应该传递给驱动程序。

如果我将 spark.driver.maxResultSize 增加到更高的值,代码可能会起作用,但我想了解为什么驱动程序需要这么多内存来进行简单的计数操作。

更多信息:

Table : Hive table on top of s3 files
File type : parquet
Compression : snappy
Partition By : date, hr
Data Size : 91 GB [date = '2020-08-13' and hr = 00 to 23]
Number of Sub folders : 24 [hr partitions]
Number of Files : 1286 [date = '2020-08-13' and hr = 00 to 23]

带有子分区条件的附加查询。

【问题讨论】:

    标签: apache-spark pyspark apache-spark-sql


    【解决方案1】:

    我认为它正在将结果发送给您的驱动程序,因为您使用了select *,然后期望驱动程序执行计数。

    如果你想计数,那么你可以试试select count(*)

    【讨论】:

    • 不正确,它没有发送给驱动程序。 spark.sql("") 创建结果的数据框并在其上调用 count() 计算数据框的大小。
    猜你喜欢
    • 2018-06-08
    • 1970-01-01
    • 1970-01-01
    • 2016-03-06
    • 1970-01-01
    • 2019-04-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多