JingsongLi commented on a change in pull request #8898:
[FLINK-12936][table-planner-blink] Support intersect all / minus all to blink
planner
URL: https://github.com/apache/flink/pull/8898#discussion_r300531061
##########
File path:
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/plan/rules/logical/ReplaceIntersectWithSemiJoinRule.scala
##########
@@ -18,25 +18,26 @@
package org.apache.flink.table.plan.rules.logical
+import
org.apache.flink.table.plan.util.SetOpRewriteUtil.generateEqualsCondition
+
+import org.apache.calcite.plan.RelOptRule.{any, operand}
import org.apache.calcite.plan.{RelOptRule, RelOptRuleCall}
-import org.apache.calcite.rel.core.{Aggregate, Intersect, Join, JoinRelType}
+import org.apache.calcite.rel.core.{Aggregate, Intersect, Join, JoinRelType,
RelFactories}
import scala.collection.JavaConversions._
/**
* Planner rule that replaces distinct [[Intersect]] with
* a distinct [[Aggregate]] on a SEMI [[Join]].
- *
- * <p>Note: Not support Intersect All.
*/
-class ReplaceIntersectWithSemiJoinRule extends ReplaceSetOpWithJoinRuleBase(
- classOf[Intersect],
+class ReplaceIntersectWithSemiJoinRule extends RelOptRule(
+ operand(classOf[Intersect], any),
+ RelFactories.LOGICAL_BUILDER,
"ReplaceIntersectWithSemiJoinRule") {
override def matches(call: RelOptRuleCall): Boolean = {
val intersect: Intersect = call.rel(0)
- // not support intersect all now.
- intersect.isDistinct
+ intersect.isDistinct && intersect.getInputs.size() == 2
Review comment:
> intersect.isDistinct => !intersect.all
Why?
> and add a TODO remove "intersect.getInputs.size() == 2" limit ?
I think this rule should never deal with size bigger than 2, we should
introduce a new rule to split it.
----------------------------------------------------------------
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]
With regards,
Apache Git Services