Class RewriteMinusAllRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.plan.RelRule<RewriteMinusAllRule.RewriteMinusAllRuleConfig>
-
- org.apache.flink.table.planner.plan.rules.logical.RewriteMinusAllRule
-
@Enclosing public class RewriteMinusAllRule extends org.apache.calcite.plan.RelRule<RewriteMinusAllRule.RewriteMinusAllRuleConfig>
Replaces logicalMinus
operator using a combination of union all, aggregate and table function.Original Query :
SELECT c1 FROM ut1 EXCEPT ALL SELECT c1 FROM ut2
Rewritten Query:
SELECT c1 FROM ( SELECT c1, sum_val FROM ( SELECT c1, sum(vcol_marker) AS sum_val FROM ( SELECT c1, 1L as vcol_marker FROM ut1 UNION ALL SELECT c1, -1L as vcol_marker FROM ut2 ) AS union_all GROUP BY union_all.c1 ) WHERE sum_val > 0 ) LATERAL TABLE(replicate_row(sum_val, c1)) AS T(c1)
Only handle the case of input size 2.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
RewriteMinusAllRule.RewriteMinusAllRuleConfig
Rule configuration.-
Nested classes/interfaces inherited from class org.apache.calcite.plan.RelRule
org.apache.calcite.plan.RelRule.Config, org.apache.calcite.plan.RelRule.Done, org.apache.calcite.plan.RelRule.MatchHandler<R extends org.apache.calcite.plan.RelOptRule>, org.apache.calcite.plan.RelRule.OperandBuilder, org.apache.calcite.plan.RelRule.OperandDetailBuilder<R extends org.apache.calcite.rel.RelNode>, org.apache.calcite.plan.RelRule.OperandTransform
-
-
Field Summary
Fields Modifier and Type Field Description static RewriteMinusAllRule
INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description protected
RewriteMinusAllRule(RewriteMinusAllRule.RewriteMinusAllRuleConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
matches(org.apache.calcite.plan.RelOptRuleCall call)
void
onMatch(org.apache.calcite.plan.RelOptRuleCall call)
-
Methods inherited from class org.apache.calcite.plan.RelOptRule
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
-
-
-
Field Detail
-
INSTANCE
public static final RewriteMinusAllRule INSTANCE
-
-
Constructor Detail
-
RewriteMinusAllRule
protected RewriteMinusAllRule(RewriteMinusAllRule.RewriteMinusAllRuleConfig config)
-
-