berkaysynnada commented on issue #15633: URL: https://github.com/apache/datafusion/issues/15633#issuecomment-2875378834
``` // Origin (faster) SELECT aggr(a + b + c) FROM t GROUP BY d; ``` this has a cost of = 2 * C_sum * N + C_agg * N ``` // After converting (slower) SELECT aggr(a), aggr(b), aggr(c) FROM t GROUP BY d; ``` the cost after conversion = 3 * C_agg * N So, if we know that C_agg is more costly (it is so probably in general), you are right, we shouldn't rewrite it. But the inverse optimization is possible, right (I don't mean to implement also that in the scope of this work, but just for study)? There might be cases also when C_sum is more lightweight, right? like first, last -- 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