cshuo commented on a change in pull request #11340: [Flink 14338] Upgrade Calcite version to 1.22 for Flink SQL URL: https://github.com/apache/flink/pull/11340#discussion_r394902742
########## File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/plan/rules/common/LogicalWindowAggregateRule.scala ########## @@ -125,6 +142,105 @@ abstract class LogicalWindowAggregateRule(ruleName: String) call.transformTo(result) } + /** Trim out the HepRelVertex wrapper and get current relational expression. */ + private def trimHep(node: RelNode): RelNode = { + node match { + case hepRelVertex: HepRelVertex => + hepRelVertex.getCurrentRel + case _ => node + } + } + + /** + * Rewrite plan with function call as window call operand: rewrite the window call to + * reference the input instead of invoking the function directly, in order to simplify the + * subsequent rewrite logic. + * + * For example, plan + * <pre> + * LogicalAggregate(group=[{0}], a=[COUNT()]) + * LogicalProject($f0=[$TUMBLE(TUMBLE_ROWTIME($0), 4:INTERVAL SECOND)], a=[$1]) + * LogicalProject($f0=[1970-01-01 00:00:00:TIMESTAMP(3)], a=[$0]) + * </pre> + * + * would be rewritten to + * <pre> + * LogicalAggregate(group=[{0}], a=[COUNT()]) + * LogicalProject($f0=[TUMBLE($1, 4:INTERVAL SECOND)], a=[$0]) + * LogicalProject(a=[$1], zzzzz=[TUMBLE_ROWTIME($0)]) + * LogicalProject($f0=[1970-01-01 00:00:00:TIMESTAMP(3)], a=[$0]) + * </pre> + */ + private def rewriteWindowCallWithFuncOperands( Review comment: I think the rewrite here and `rewriteProctimeWindows` are both unnecessary after [FLINK-15494](https://github.com/apache/flink/pull/10784). ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services