Skip to content

Conversation

@gabotechs
Copy link
Contributor

@gabotechs gabotechs commented Oct 20, 2025

Which issue does this PR close?

  • No issue.

Rationale for this change

Users might want to create their own PhysicalOptimizerRule implementations. Users might have their own SessionConfig.extensions. Users might want to use their own SessionConfig.extensions in their custom PhysicalOptimizerRule implementations.

This PR is needed for gabotechs#7, but it was factored out as it's an isolated change that could have value on its own.

What changes are included in this PR?

Changes signature of PhysicalOptimizerRule.optimze to take a SessionConfig rather than a ConfigOptions.

pub trait PhysicalOptimizerRule: Debug {
    /// Rewrite `plan` to an optimized form
    fn optimize(
        &self,
        plan: Arc<dyn ExecutionPlan>,
-       config: &ConfigOptions,
+       config: &SessionConfig,
    ) -> Result<Arc<dyn ExecutionPlan>>;
    ...
}

Are these changes tested?

yes, by current tests.

Are there any user-facing changes?

yes, PhysicalOptimizerRule.optimze now takes a SessionConfig rather than a ConfigOptions, which is a breaking non backwards compatible change.

@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate datasource Changes to the datasource crate physical-plan Changes to the physical-plan crate labels Oct 20, 2025
@gabotechs gabotechs force-pushed the change-physical-optimizer-rule-signature branch 2 times, most recently from 75e9a56 to 3a445e3 Compare October 20, 2025 10:06
@gabotechs gabotechs force-pushed the change-physical-optimizer-rule-signature branch from 3a445e3 to f722d32 Compare October 20, 2025 10:40
Copy link
Contributor

@adriangb adriangb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a reasonable change to me, but I think we should wait until we are certain we are going to need it for #18172 before we merge it to avoid breaking the API without good justification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate datasource Changes to the datasource crate optimizer Optimizer rules physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants