Skip to content

Conversation

@adriangb
Copy link
Contributor

@adriangb adriangb commented Dec 27, 2025

In trying to fix #19418 I kept getting turned around about what was needed where. The SimplifyInfo trait made it extra hard to understand. I ended up realizing that the main reason for the trait to exist was tests. Removing the trait and adding a builder style API to SimplifyContext made it IMO more ergonomic for tests and other call sites, easier to track the code (no trait opaqueness) and clearer what simplification capabilities are available in each site. This got rid of e.g. some places where we were calling ExecutionProps::new() just to pass that into SimplifyContext which in turn would hand out references to the default query time, a default ContigOptions, etc; or in datafusion/core/src/execution/session_state.rs where we did let dummy_schema = DFSchema::empty().

This let me solve several problems:

  • Can store optimized logical plans for prepared statements
  • Users can optionally run an optimizer pass on logical plans without evaluating time functions

Compared to #19426 this avoids adding a config option and is actually less lines of code (negative diff).

Fixes #19418, closes #19426 (replaces it).

@github-actions github-actions bot added logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate functions Changes to functions implementation spark labels Dec 27, 2025
@adriangb adriangb marked this pull request as ready for review December 27, 2025 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate functions Changes to functions implementation logical-expr Logical plan and expressions optimizer Optimizer rules spark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

option to disable evaluation of stable expressions in optimizer rules

1 participant