peter-toth opened a new pull request, #11265: URL: https://github.com/apache/datafusion/pull/11265
## Which issue does this PR close? Part of https://github.com/apache/datafusion/issues/11194. ## Rationale for this change Curently `CommonSubexprEliminate` always skips expressions doesn't allow volatile expressions to be extracted, but this can be improved by allowing non-volatile subexpressions of volatile expressions to be extracted: I.e. from the plan: ``` Projection (a + b) + rand() AS c1, (a + b) + rand() AS c2 ``` the expression `a + b` can be extracted as common expression despite the fact that `(a + b) + rand()` is volatile. ## What changes are included in this PR? Changes the rule to handle volatile expressions better by adding a new boolean flag to `VisitRecord::ExprItem` and propagating up volatility (validity for CSE). ## Are these changes tested? Yes, added new UT. ## Are there any user-facing changes? No. -- 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]
