Class SubQueryDecorrelator
- java.lang.Object
-
- org.apache.calcite.rel.RelShuttleImpl
-
- org.apache.flink.table.planner.plan.rules.logical.SubQueryDecorrelator
-
- All Implemented Interfaces:
org.apache.calcite.rel.RelShuttle
public class SubQueryDecorrelator extends org.apache.calcite.rel.RelShuttleImpl
SubQueryDecorrelator finds all correlated expressions in a SubQuery, and gets an equivalent non-correlated relational expression tree and correlation conditions.The Basic idea of SubQueryDecorrelator is from
RelDecorrelator
, however there are differences between them: 1. This class works withRexSubQuery
, while RelDecorrelator works withLogicalCorrelate
. 2. This class will get an equivalent non-correlated expressions tree and correlation conditions, while RelDecorrelator will replace all correlated expressions with non-correlated expressions that are produced from joining the RelNode. 3. This class supports both equi and non-equi correlation conditions, while RelDecorrelator only supports equi correlation conditions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SubQueryDecorrelator.Result
Result describing the relational expression after decorrelation and where to find the equivalent non-correlated expressions and correlated conditions.static class
SubQueryDecorrelator.SubQueryRelDecorrelator
Pull out all correlation conditions from a given subquery to top level, and rebuild the subquery rel tree without correlation conditions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SubQueryDecorrelator.Result
decorrelateQuery(org.apache.calcite.rel.RelNode rootRel)
Decorrelates a subquery.org.apache.calcite.rel.RelNode
visit(org.apache.calcite.rel.logical.LogicalFilter filter)
protected org.apache.calcite.rel.RelNode
visitChild(org.apache.calcite.rel.RelNode parent, int i, org.apache.calcite.rel.RelNode input)
-
-
-
Method Detail
-
decorrelateQuery
public static SubQueryDecorrelator.Result decorrelateQuery(org.apache.calcite.rel.RelNode rootRel)
Decorrelates a subquery.This is the main entry point to
SubQueryDecorrelator
.- Parameters:
rootRel
- The node which has SubQuery.- Returns:
- Decorrelate result.
-
visitChild
protected org.apache.calcite.rel.RelNode visitChild(org.apache.calcite.rel.RelNode parent, int i, org.apache.calcite.rel.RelNode input)
- Overrides:
visitChild
in classorg.apache.calcite.rel.RelShuttleImpl
-
visit
public org.apache.calcite.rel.RelNode visit(org.apache.calcite.rel.logical.LogicalFilter filter)
- Specified by:
visit
in interfaceorg.apache.calcite.rel.RelShuttle
- Overrides:
visit
in classorg.apache.calcite.rel.RelShuttleImpl
-
-