You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Thread PhysicalOptimizerContext through join_selection stats helpers (CBO extension pattern) #23671
Is your feature request related to a problem or challenge?
JoinSelection's internal stats helpers (get_stats, should_swap_join_order, supports_collect_by_thresholds) take Option<&StatisticsRegistry> and &ConfigOptions pre-extracted from the PhysicalOptimizerContext. Every new
session-scoped input added to the context for cost-based estimation forces a
signature change across all three helpers and their call sites.
Describe the solution you'd like
Pass &dyn PhysicalOptimizerContext to these helpers instead; they read statistics_registry() / config_options() off it. New context inputs then need
no helper-signature changes.
This is also the pattern any future physical optimizer rule implementing CBO
should follow: take the PhysicalOptimizerContext and read what it needs off it,
rather than threading individual extracted inputs.
Describe alternatives you've considered
Keep threading individual params — every new input churns all three signatures.
Pass SessionState directly — not possible; datafusion-physical-optimizer
can't depend on datafusion-core, which is why PhysicalOptimizerContext
exists.
Additional context
Non-breaking, mechanical: the helpers are crate-internal (get_stats / supports_collect_by_thresholds private, should_swap_join_orderpub(crate)),
no cross-crate callers, public PhysicalOptimizerRule methods unchanged.
Activity
asolimando commentedon Jul 17, 2026
take
asolimando commentedon Jul 29, 2026
This actually depends on #23651, so waiting for that contribution to land before we can create a PR
refactor: thread PhysicalOptimizerContext through join_selection stat…