adriangb opened a new pull request, #19426: URL: https://github.com/apache/datafusion/pull/19426
## Summary This PR adds a new configuration option `datafusion.optimizer.evaluate_stable_expressions` (default: `true`) that controls whether stable functions like `now()`, `current_date()`, and `current_time()` are evaluated to literal values during query planning. When set to `false`, stable functions are preserved in the plan rather than being converted to literals. This is useful for query rewrites that need to preserve stable function calls. ## Changes 1. Added new config option `evaluate_stable_expressions` to `OptimizerOptions` 2. Modified `ConstEvaluator.volatility_ok()` to check the config 3. Updated `simplify()` methods in `now()`, `current_date()`, `current_time()` to respect the config 4. Added unit tests and SLT test ## Usage ```sql -- Disable stable expression evaluation SET datafusion.optimizer.evaluate_stable_expressions = false; -- now() will remain as a function call in the plan EXPLAIN SELECT now(); ``` Closes #19418 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
