ozankabak commented on PR #5171: URL: https://github.com/apache/arrow-datafusion/pull/5171#issuecomment-1421617531
I think it makes sense to explain the evolution of this so that everybody has a richer context. We actually started with two rules, one enforcement rule and one optimization rule (remember `optimize_sorts`?). As we worked on that design over time, the optimization rule grew to carry out the following tasks: - Optimization rule sometimes removes sorts (only). - Optimization rule sometimes moves a sort somewhere else. - Optimization rule sometimes ends up removing multiple sorts but doing so requires adding fewer sorts elsewhere. Here, you see examples of a general pattern where there could be `N` additions and `M` removals. Actually, simple enforcement corresponds to the case `M` = 0, and the optimization rule can end up with any of the remaining cases. Since doing the latter requires almost 95% of the code of a general any `N`/any `M` solution, we ended up merging the rules. This greatly reduced code duplication and IMO made the rule easier to use. -- 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]
