You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "parthchandra (via GitHub)" <gi...@apache.org> on 2026/08/18 23:22:22 UTC

[I] Native shuffle fails with a 2GB task serialization OOM on jobs with very many partitions [datafusion-comet]

parthchandra opened a new issue, #5391:
URL: https://github.com/apache/datafusion-comet/issues/5391

   ### Describe the bug
   
   A job with a huge number of scan partitions fails at stage submission:
   
     ```
     Task serialization failed: java.lang.OutOfMemoryError: Required array length 2147483639 + 794 is too large
         at java.io.ByteArrayOutputStream.ensureCapacity(...)
         at org.apache.spark.serializer.JavaSerializerInstance.serialize(...)
         at org.apache.spark.scheduler.DAGScheduler.submitMissingTasks(DAGScheduler.scala:1528)
     ```
   
     A single `byte[]` can't exceed ~2GB, and the driver is serializing one object bigger than that. The failing job had ~38.7M partitions (multi-petabyte dataset), native scan into a native shuffle. The same job runs fine on plain Spark, so it's something Comet does differently, not just scale.
   
   
     ### Analysis
   
     `DAGScheduler.submitMissingTasks` serializes the `(RDD, ShuffleDependency)` pair once into a single broadcast byte array, which must fit in ~2GB. On the native shuffle path, `CometShuffleDependency.nativeShuffleSpec` is a non-transient field holding a `NativeExecContext` whose `perPartitionByKey: Map[String, Array[Array[Byte]]]` carries one
     serialized scan plan-data blob (the partition's file list) per map partition. With ~38.7M partitions that's ~38.7M protobufs baked into the broadcast task binary, so it exceeds 2GB — even though each write task only ever reads its own partition's slice.
   
     Spark's `FileScanRDD` keeps per-partition file lists `@transient`; each partition's files ride in its own `Partition` object and are serialized separately per task, so the full list  is never included in the shared broadcast blob.
   
   ### Steps to reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Native shuffle fails with a 2GB task serialization OOM on jobs with very many partitions [datafusion-comet]

Posted by "parthchandra (via GitHub)" <gi...@apache.org>.
parthchandra closed issue #5391: Native shuffle fails with a 2GB task serialization OOM on jobs with very many partitions
URL: https://github.com/apache/datafusion-comet/issues/5391


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org