public class RelDecorrelator extends Object implements org.apache.calcite.util.ReflectiveVisitor
Modifier and Type | Class and Description |
---|---|
static class |
RelDecorrelator.AdjustProjectForCountAggregateRule
Planner rule that adjusts projects when counts are added.
|
static interface |
RelDecorrelator.Config
Base configuration for rules that are non-static in a RelDecorrelator.
|
protected static class |
RelDecorrelator.CorelMap
A map of the locations of
Correlate in a tree of RelNode s. |
static class |
RelDecorrelator.CorelMapBuilder
Builds a
RelDecorrelator.CorelMap . |
static class |
RelDecorrelator.RemoveCorrelationForScalarAggregateRule
Planner rule that removes correlations for scalar aggregates.
|
static class |
RelDecorrelator.RemoveCorrelationForScalarProjectRule
Planner rule that removes correlations for scalar projects.
|
static class |
RelDecorrelator.RemoveSingleAggregateRule
Rule to remove an Aggregate with SINGLE_VALUE.
|
Modifier and Type | Field and Description |
---|---|
protected RelDecorrelator.CorelMap |
cm |
protected org.apache.calcite.plan.Context |
context |
protected @Nullable org.apache.calcite.rel.RelNode |
currentRel |
protected org.apache.calcite.util.ReflectUtil.MethodDispatcher<org.apache.calcite.sql2rel.RelDecorrelator.Frame> |
dispatcher |
protected HashSet<org.apache.calcite.rel.core.Correlate> |
generatedCorRels |
protected Map<org.apache.calcite.rel.RelNode,org.apache.calcite.sql2rel.RelDecorrelator.Frame> |
map
Built during decorrelation, of rel to all the newly created correlated variables in its
output, and to map old input positions to new input positions.
|
protected RelBuilder |
relBuilder |
Modifier | Constructor and Description |
---|---|
protected |
RelDecorrelator(RelDecorrelator.CorelMap cm,
org.apache.calcite.plan.Context context,
RelBuilder relBuilder) |
Modifier and Type | Method and Description |
---|---|
protected org.apache.calcite.rel.RelNode |
decorrelate(org.apache.calcite.rel.RelNode root) |
protected org.apache.calcite.rex.RexNode |
decorrelateExpr(org.apache.calcite.rel.RelNode currentRel,
Map<org.apache.calcite.rel.RelNode,org.apache.calcite.sql2rel.RelDecorrelator.Frame> map,
RelDecorrelator.CorelMap cm,
org.apache.calcite.rex.RexNode exp) |
static org.apache.calcite.rel.RelNode |
decorrelateQuery(org.apache.calcite.rel.RelNode rootRel)
Deprecated.
|
static org.apache.calcite.rel.RelNode |
decorrelateQuery(org.apache.calcite.rel.RelNode rootRel,
RelBuilder relBuilder)
Decorrelates a query.
|
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Aggregate rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Correlate rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Filter rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Join rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalAggregate rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalCorrelate rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalFilter rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalJoin rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalProject rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(LogicalSnapshot rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.logical.LogicalTableFunctionScan rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Project rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.RelNode rel,
boolean isCorVarDefined)
Fallback if none of the other
decorrelateRel methods match. |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Sort rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
decorrelateRel(org.apache.calcite.rel.core.Values rel,
boolean isCorVarDefined) |
@Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame |
getInvoke(org.apache.calcite.rel.RelNode r,
boolean isCorVarDefined,
@Nullable org.apache.calcite.rel.RelNode parent) |
protected Collection<org.apache.calcite.plan.RelOptRule> |
getPostDecorrelateRules()
Returns the rules applied on the rel after decorrelation, never null.
|
protected RelDecorrelator |
getVisitor()
Returns the
visitor on which the MethodDispatcher dispatches each decorrelateRel method, the default implementation returns this instance, if you got a
sub-class, override this method to replace the visitor as the sub-class instance. |
protected org.apache.calcite.tools.RelBuilderFactory |
relBuilderFactory() |
protected org.apache.calcite.rex.RexNode |
removeCorrelationExpr(org.apache.calcite.rex.RexNode exp,
boolean projectPulledAboveLeftCorrelator) |
protected org.apache.calcite.rex.RexNode |
removeCorrelationExpr(org.apache.calcite.rex.RexNode exp,
boolean projectPulledAboveLeftCorrelator,
org.apache.calcite.rex.RexInputRef nullIndicator) |
protected org.apache.calcite.rex.RexNode |
removeCorrelationExpr(org.apache.calcite.rex.RexNode exp,
boolean projectPulledAboveLeftCorrelator,
Set<Integer> isCount) |
org.apache.calcite.rel.RelNode |
removeCorrelationViaRule(org.apache.calcite.rel.RelNode root) |
protected final RelBuilder relBuilder
protected RelDecorrelator.CorelMap cm
protected final org.apache.calcite.util.ReflectUtil.MethodDispatcher<org.apache.calcite.sql2rel.RelDecorrelator.Frame> dispatcher
protected @Nullable org.apache.calcite.rel.RelNode currentRel
protected final org.apache.calcite.plan.Context context
protected final Map<org.apache.calcite.rel.RelNode,org.apache.calcite.sql2rel.RelDecorrelator.Frame> map
protected final HashSet<org.apache.calcite.rel.core.Correlate> generatedCorRels
protected RelDecorrelator(RelDecorrelator.CorelMap cm, org.apache.calcite.plan.Context context, RelBuilder relBuilder)
@Deprecated public static org.apache.calcite.rel.RelNode decorrelateQuery(org.apache.calcite.rel.RelNode rootRel)
public static org.apache.calcite.rel.RelNode decorrelateQuery(org.apache.calcite.rel.RelNode rootRel, RelBuilder relBuilder)
This is the main entry point to RelDecorrelator
.
rootRel
- Root node of the queryrelBuilder
- Builder for relational expressionsCorrelate
instances
removedprotected org.apache.calcite.tools.RelBuilderFactory relBuilderFactory()
protected org.apache.calcite.rel.RelNode decorrelate(org.apache.calcite.rel.RelNode root)
public org.apache.calcite.rel.RelNode removeCorrelationViaRule(org.apache.calcite.rel.RelNode root)
protected org.apache.calcite.rex.RexNode decorrelateExpr(org.apache.calcite.rel.RelNode currentRel, Map<org.apache.calcite.rel.RelNode,org.apache.calcite.sql2rel.RelDecorrelator.Frame> map, RelDecorrelator.CorelMap cm, org.apache.calcite.rex.RexNode exp)
protected org.apache.calcite.rex.RexNode removeCorrelationExpr(org.apache.calcite.rex.RexNode exp, boolean projectPulledAboveLeftCorrelator)
protected org.apache.calcite.rex.RexNode removeCorrelationExpr(org.apache.calcite.rex.RexNode exp, boolean projectPulledAboveLeftCorrelator, org.apache.calcite.rex.RexInputRef nullIndicator)
protected org.apache.calcite.rex.RexNode removeCorrelationExpr(org.apache.calcite.rex.RexNode exp, boolean projectPulledAboveLeftCorrelator, Set<Integer> isCount)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.RelNode rel, boolean isCorVarDefined)
decorrelateRel
methods match.public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Sort rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Values rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalAggregate rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Aggregate rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame getInvoke(org.apache.calcite.rel.RelNode r, boolean isCorVarDefined, @Nullable org.apache.calcite.rel.RelNode parent)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalProject rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Project rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(LogicalSnapshot rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalTableFunctionScan rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalFilter rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Filter rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalCorrelate rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Correlate rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.logical.LogicalJoin rel, boolean isCorVarDefined)
public @Nullable org.apache.calcite.sql2rel.RelDecorrelator.Frame decorrelateRel(org.apache.calcite.rel.core.Join rel, boolean isCorVarDefined)
protected RelDecorrelator getVisitor()
visitor
on which the MethodDispatcher
dispatches each decorrelateRel
method, the default implementation returns this instance, if you got a
sub-class, override this method to replace the visitor
as the sub-class instance.protected Collection<org.apache.calcite.plan.RelOptRule> getPostDecorrelateRules()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.