zhuqi-lucas commented on issue #15524: URL: https://github.com/apache/datafusion/issues/15524#issuecomment-2771825207
> I'm wondering if instead of this specialized > > `SUM(x + c) -> SUM(x) * COUNT() * c` > > We can do instead the more general (distributive property of summation - doesn't need to be a constant): > > ``` > SUM(x + y) -> SUM(x) + SUM(y) > ``` > > And have other optimizations follow (transform `SUM(y) -> COUNT() * y` when y is constant, common subexpression elimination, etc.) Thank you @Dandandan for this good idea, i agree with you, it's a more common solution and it will benefit more cases. And meanwhile, may be we can do more cases in future, such as when MAX(x) > 0: MAX(5 * x) => 5 * MAX(x) etc -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org