vishalkotak opened a new pull request, #27742: URL: https://github.com/apache/datafusion/pull/27742
## Which issue does this PR close? - Closes #27683. ## Rationale for this change Adding a redundant comparison to a filter could change how often a volatile function like random() runs. When the optimizer merged the comparisons, it moved the volatile call to the front, so it ran on every row instead of only the rows the earlier comparisons kept. ## What changes are included in this PR? Merged comparisons now stay where the first of them was written, and every other predicate keeps its place. A merged comparison is at least as strict as the ones it replaces, so nothing after it sees more rows than before. ## What is the testing strategy for this PR? Added the example from the issue, which counts how often the volatile function runs, and plan tests for the other cases the issue lists. Two existing plan tests change order: predicates now follow the query instead of being grouped by column. ## 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]
