oleg-zinovev commented on code in PR #12096: URL: https://github.com/apache/ignite/pull/12096#discussion_r2253911086
########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/PlannerPhase.java: ########## @@ -98,6 +101,22 @@ public enum PlannerPhase { } }, + /** */ + HEP_WINDOW_SPLIT("Heuristic phase to split project to project and window") { + @Override public RuleSet getRules(PlanningContext ctx) { + return ctx.rules( + RuleSets.ofList( + CoreRules.PROJECT_TO_LOGICAL_PROJECT_AND_WINDOW, Review Comment: @alex-plekhanov **Problem** Calciteās FILTER_PROJECT_TRANSPOSE rule does not transpose filters when the projection contains an OVER clause (i.e., a window function). This behavior is explicitly enforced in FilterProjectTransposeRule.java. At the same time, window-specific rules like FILTER_WINDOW_TRANSPOSE and PROJECT_WINDOW_TRANSPOSE only apply after window expressions have been converted into logical Window nodes. **Observation** This creates a limitation: During the HEP_FILTER_PUSH_DOWN and HEP_PROJECT_PUSH_DOWN phases, filters and projections cannot be pushed down if OVER expressions are still embedded in projections. Conclusion To ensure proper operation of HEP_FILTER_PUSH_DOWN and HEP_PROJECT_PUSH_DOWN, all OVER expressions must be already transformed into logical Window relations beforehand. **Suggested Actions** - Add PROJECT_TO_LOGICAL_PROJECT_AND_WINDOW in HEP_FILTER_PUSH_DOWN pahse so that the transformation of OVER into LogicalWindow occurs before other filter push down rules. - Alternatively, introduce an intermediate phase to extract OVER expressions earlier in the pipeline (HEP_WINDOW_SPLIT phase in pull request) Let me know if you'd like to propose a more robust solution. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org