dawidwys commented on code in PR #24253: URL: https://github.com/apache/flink/pull/24253#discussion_r1481687197
########## flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/LogicalCorrelateToJoinFromTemporalTableRule.scala: ########## @@ -323,15 +306,47 @@ abstract class LogicalCorrelateToJoinFromGeneralTemporalTableRule( } val builder = call.builder() - val condition = builder.and(joinCondition, temporalCondition) - - builder.push(leftInput) - builder.push(snapshot) - builder.join(correlate.getJoinType, condition) - val temporalJoin = builder.build() + val condition = builder.and(actualJoin.getCondition, temporalCondition) + + val joinWithTemporalCondition = actualJoin.copy( + actualJoin.getTraitSet, + condition, + actualJoin.getLeft, + actualJoin.getRight, + actualJoin.getJoinType, + actualJoin.isSemiJoinDone) + + val temporalJoin = if (actualJoin != rewriteJoin) { + rewriteJoin.replaceInput(0, joinWithTemporalCondition) Review Comment: What test cases do you have in mind? As far as I can tell we don't have a pushdown through a correlate. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org