jrthe42 commented on a change in pull request #14404:
URL: https://github.com/apache/flink/pull/14404#discussion_r546571928
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/physical/stream/StreamExecJoinRuleBase.scala
##########
@@ -70,28 +70,30 @@ abstract class StreamExecJoinRuleBase(description: String)
.replace(distribution)
}
- val newRight = right match {
- case snapshot: FlinkLogicalSnapshot =>
- snapshot.getInput
- case rel: FlinkLogicalRel => rel
+ def convertInput(input: RelNode, columns: util.Collection[_ <: Number]):
RelNode = {
+ val requiredTraitSet = toHashTraitByColumns(columns, input.getTraitSet)
+ RelOptRule.convert(input, requiredTraitSet)
}
val joinInfo = join.analyzeCondition
- val (leftRequiredTrait, rightRequiredTrait) = (
- toHashTraitByColumns(joinInfo.leftKeys, left.getTraitSet),
- toHashTraitByColumns(joinInfo.rightKeys, newRight.getTraitSet))
-
- val convertedLeft: RelNode = RelOptRule.convert(left, leftRequiredTrait)
- val convertedRight: RelNode = RelOptRule.convert(newRight,
rightRequiredTrait)
val providedTraitSet: RelTraitSet =
join.getTraitSet.replace(FlinkConventions.STREAM_PHYSICAL)
- val newJoin = transform(join, convertedLeft, convertedRight,
providedTraitSet)
+ val leftConversion = leftInput => {
+ convertInput(leftInput, joinInfo.leftKeys)
+ }
+ val rightConversion = rightInput => {
+ convertInput(rightInput, joinInfo.rightKeys)
+ }
+
+ val newJoin = transform(join, left, leftConversion, right,
rightConversion, providedTraitSet)
call.transformTo(newJoin)
}
protected def transform(
join: FlinkLogicalJoin,
- convertedLeft: RelNode,
- convertedRight: RelNode,
+ leftInput: FlinkRelNode,
Review comment:
`join.getLeft` and `join.getRight` will return `RelSubset`, we can not
use that directly
----------------------------------------------------------------
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:
[email protected]