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

   ### What is the problem the feature request solves?
   
   Every native shuffle block is a self-contained Arrow IPC stream: schema 
message, dictionary messages, record batch message, end-of-stream marker. On 
the read side `read_single_batch` builds a fresh `StreamReader` for each block, 
so the schema flatbuffer is parsed once per block, even though every block in a 
shuffle carries the same schema and the reducer already knows that schema from 
the plan protobuf (`ShuffleScanExec` builds it from `data_types`).
   
   The write side already avoids the mirror image of this cost. 
`ShuffleBlockWriter` encodes the schema flatbuffer once in `try_new` and writes 
those pre-encoded bytes verbatim at the start of every block 
(`SchemaEncoding::Precoded`) rather than re-serializing per block. The reader 
has no equivalent.
   
   Blocks per reduce task scale with the number of mappers times the number of 
blocks each mapper wrote for that partition, and a mapper writes at least one 
block per spill round, so this grows with both cluster width and memory 
pressure.
   
   ### Describe the potential solution
   
   The cost to remove is the flatbuffer parse and `StreamReader` setup, not 
I/O: the schema message sits inside the compressed stream and is decompressed 
either way. A reader that caches the parsed schema and skips re-parsing when a 
block's decompressed schema message matches the cached bytes would keep the 
current block format intact.
   
   Dropping the schema message from the format outright would be cheaper still, 
since the reducer does not need it, but that changes the wire format and would 
have to account for the RSS path and for the dictionary-schema fallback, which 
does not use `Precoded`.
   
   Unmeasured so far. Worth a read-side benchmark at a high mapper count before 
acting.
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to