jnh5y commented on code in PR #24253: URL: https://github.com/apache/flink/pull/24253#discussion_r1481679233
########## 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: Are there test cases which cover adding the projection? Also, does this run into any issues if there are multiple pushdowns? -- 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