timsaucer commented on issue #11594: URL: https://github.com/apache/datafusion/issues/11594#issuecomment-2242754551
Off the cuff, if we go down this avenue I'd imagine wanting to check for associative, commutative, and distributive properties. For example, `(3*x + 8) + (5 + x*9) = 12x + 13` takes 5 operations on the left hand side but 3 operations on the right. `(3*x +1) * x + 7* x = 3 * x^2 + 8*x` takes 5 operations on the lhs and 4 on the rhs. In these examples, `x` is any expression. Associativity by itself my not pick up on `3 * x` combining with `x * 9`, though maybe the simplifier already handles that. Again, I've only now taking a cursory look at the simplifier. I can imagine one approach of: 1. distribute first 2. commute all terms according to some ordering scheme - this should handle both multiplication and addition 3. attempt pair wise simplification until no additional simplification can be done -- 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