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 with RexSubQuery, while RelDecorrelator works with LogicalCorrelate.
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 ClassesModifier and TypeClassDescriptionstatic classResult describing the relational expression after decorrelation and where to find the equivalent non-correlated expressions and correlated conditions.static classPull out all correlation conditions from a given subquery to top level, and rebuild the subquery rel tree without correlation conditions. -
Field Summary
Fields inherited from class org.apache.calcite.rel.RelShuttleImpl
stack -
Method Summary
Modifier and TypeMethodDescriptionstatic SubQueryDecorrelator.ResultdecorrelateQuery(org.apache.calcite.rel.RelNode rootRel) Decorrelates a subquery.org.apache.calcite.rel.RelNodevisit(org.apache.calcite.rel.logical.LogicalFilter filter) protected org.apache.calcite.rel.RelNodevisitChild(org.apache.calcite.rel.RelNode parent, int i, org.apache.calcite.rel.RelNode input) Methods inherited from class org.apache.calcite.rel.RelShuttleImpl
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitChildren
-
Method Details
-
decorrelateQuery
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:
visitChildin classorg.apache.calcite.rel.RelShuttleImpl
-
visit
public org.apache.calcite.rel.RelNode visit(org.apache.calcite.rel.logical.LogicalFilter filter) - Specified by:
visitin interfaceorg.apache.calcite.rel.RelShuttle- Overrides:
visitin classorg.apache.calcite.rel.RelShuttleImpl
-