n个任务的序列化结果的总大小(x mb)大于spark.driver.maxresultsize

hts6caw3  于 2021-05-27  发布在  Spark
关注(0)|答案(1)|浏览(521)

在对sparkDataframe执行简单的计数操作时,出现以下错误。

  1. 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)


设置:

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

我不知道为什么这段简单的代码会向驱动程序发送超过1GB的数据。理想情况下,整个计算应该在执行器中进行,只有结果应该提交给驱动程序。
如果我将spark.driver.maxresultsize增加到一个更高的值,代码可能会工作,但是我想理解为什么驱动程序需要这么多内存来进行简单的计数操作。
更多信息:

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

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

flvlnr44

flvlnr441#

我认为它正在把结果发送给你的司机,因为你已经使用了 select * 然后期望驱动程序执行计数。
如果你想数数,那你可以试试 select count(*) .

相关问题