leonardBang commented on a change in pull request #13300: URL: https://github.com/apache/flink/pull/13300#discussion_r512793454
########## File path: flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/utils/TemporalJoinUtil.scala ########## @@ -197,8 +294,121 @@ object TemporalJoinUtil { rowtimeJoin } - def isRowTimeTemporalJoinConditionCall(rexCall: RexCall): Boolean = { - rexCall.getOperator == TEMPORAL_JOIN_CONDITION && rexCall.operands.length > 3 + def isRowTimeTemporalTableJoinCon(rexCall: RexCall): Boolean = { + //(LEFT_TIME_ATTRIBUTE, RIGHT_TIME_ATTRIBUTE, LEFT_KEY, RIGHT_KEY, PRIMARY_KEY) + rexCall.getOperator == TEMPORAL_JOIN_CONDITION && rexCall.operands.length == 5 + } + + def isRowTimeTemporalFunctionJoinCon(rexCall: RexCall): Boolean = { + //(LEFT_TIME_ATTRIBUTE, RIGHT_TIME_ATTRIBUTE, PRIMARY_KEY) + rexCall.getOperator == TEMPORAL_JOIN_CONDITION && rexCall.operands.length == 3 } + def isTemporalFunctionJoin(rexBuilder: RexBuilder, joinInfo: JoinInfo): Boolean = { + val nonEquiJoinRex = joinInfo.getRemaining(rexBuilder) + var isTemporalFunctionJoin: Boolean = false + val visitor = new RexVisitorImpl[Unit](true) { + override def visitCall(call: RexCall): Unit = { + if (isTemporalFunctionCon(call)) { + isTemporalFunctionJoin = true + } else { + super.visitCall(call) + } + } + } + nonEquiJoinRex.accept(visitor) + isTemporalFunctionJoin + } + + def isTemporalFunctionCon(rexCall: RexCall): Boolean = { + //(LEFT_TIME_ATTRIBUTE, PRIMARY_KEY) + //(LEFT_TIME_ATTRIBUTE, RIGHT_TIME_ATTRIBUTE, PRIMARY_KEY) + rexCall.getOperator == TEMPORAL_JOIN_CONDITION && + (rexCall.operands.length == 2 || rexCall.operands.length == 3) + } + + def validateAndExtractTemporalFunctionCondition( + call: RexCall, + leftTimeAttribute: Option[RexNode], + rightTimeAttribute: Option[RexNode], Review comment: `leftTimeAttribute` can be `RexNode`, `rightTimeAttribute` can not because it may be `None` ---------------------------------------------------------------- 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