andygrove opened a new pull request, #2912:
URL: https://github.com/apache/datafusion-ballista/pull/2912

   # Which issue does this PR close?
   
   Closes #2908.
   
   # Rationale for this change
   
   Exchange reuse (`ballista.planner.reuse_exchange.enabled`, on by default) 
never shares a stage for an embedder that registers its physical extension 
codec only through `SchedulerConfig::override_physical_codec`. The reuse key 
encodes each stage with the session's codec, which is Ballista's default unless 
the client also sets the codec on the session. The default codec cannot encode 
the embedder's operators, so the key is `None` and the stage runs again. 
Nothing is logged.
   
   With Comet Native Executors on TPC-H SF100, q18 ran its `lineitem` partial 
aggregate twice. Setting the codec on the session as a workaround made the 
stages shared and took q18 from about 41s to 20s on one 16-slot executor.
   
   # What changes are included in this PR?
   
   - `AdaptivePlanner` keeps the codec it encodes reuse keys with. It defaults 
to the session's codec, and `TaskManager` replaces it with the scheduler's 
codec, the one stages ship to executors with. This matches the intent in the 
`reuse_exchange` module docs that two stages match only when an executor could 
not tell them apart.
   - `AdaptiveExecutionGraph::try_new` and `try_new_from_physical` take the 
codec as an optional argument. `None` keeps the session's codec. The `aqe` 
module is crate-private.
   - `reuse_key` logs at debug level when a stage cannot be encoded, so a stage 
that is silently not shared is visible.
   - `BallistaCodec::physical_extension_codec_arc` returns a shared handle to 
the physical codec, since the planner holds it for the life of the job.
   
   The new test `an_embedders_stages_are_matched_with_the_scheduler_codec` 
plans two identical exchanges over an operator that only a test codec can 
encode. With the session's codec it gets two stages, as before this change. 
With the scheduler's codec it gets one.
   
   # Are there any user-facing changes?
   
   Embedders that set `SchedulerConfig::override_physical_codec` now get 
exchange reuse without also setting the codec on the session. There is one 
additive public method, `BallistaCodec::physical_extension_codec_arc`. No 
breaking API changes.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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