andygrove opened a new issue, #2908: URL: https://github.com/apache/datafusion-ballista/issues/2908
> **LLM acknowledgement:** this issue was drafted by an LLM (Claude Code) while benchmarking Comet Native Executors (a Ballista embedder) on TPC-H SF100. It is framed as research: the analysis below comes from reading the code at `a882d9d8` and one benchmark observation, and it needs a maintainer to confirm it. ## Observation Exchange reuse (`ballista.planner.reuse_exchange.enabled`, on by default) never fired for an embedder that registers its own physical extension codec through `SchedulerConfig::override_physical_codec`. In TPC-H q18, two identical stages (the same partial aggregate of `lineitem`, 150M rows each) both ran. Once the embedder also set the codec on the session (`SessionConfig::with_ballista_physical_extension_codec`), the stages were shared and q18 went from ~41 s to ~20 s on one 16-slot executor. ## Why `AdaptivePlanner::find_runnable_exchanges_reusing_stages` (`scheduler/src/state/aqe/planner.rs`) keys each exchange with `reuse_key(exec, &codec)`, where `codec` is `config.ballista_physical_extension_codec()`: the codec stored on the *session* config, falling back to `BallistaPhysicalExtensionCodec::default()`. The scheduler itself encodes and ships stages with `SchedulerConfig::override_physical_codec` (`scheduler_process.rs`), which a session doesn't see unless the client also set it. With the default codec, `physical_plan_to_bytes_with_extension_codec` fails for an embedder's extension node, `reuse_key` returns `None`, and the exchange is silently never shared. Nothing is logged. ## Questions to research - Should the reuse key use the scheduler's codec (the one stages actually ship with) rather than the session's? That would match the module doc's intent: "two subtrees match only when an executor could not tell them apart". - Alternatively, should the scheduler set `BallistaConfigExtensionPhysicalCodec` on every session it creates when `override_physical_codec` is set, so that every session-level consumer of the codec agrees with the scheduler? - At minimum, a `debug!` or `warn!` when `reuse_key` can't encode a stage would have made this visible. -- 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]
