Allow logical optimizer to be run without evaluating now() & refactor SimplifyInfo #19505
+415
−475
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In trying to fix #19418 I kept getting turned around about what was needed where. The
SimplifyInfotrait 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 toSimplifyContextmade 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 callingExecutionProps::new()just to pass that intoSimplifyContextwhich in turn would hand out references to the default query time, a defaultContigOptions, etc; or indatafusion/core/src/execution/session_state.rswhere we didlet dummy_schema = DFSchema::empty().This let me solve several problems:
Compared to #19426 this avoids adding a config option and is actually less lines of code (negative diff).
Fixes #19418, closes #19426 (replaces it).