public class FilterProjectTransposeRule extends RelOptRule
Modifier and Type | Field and Description |
---|---|
private boolean |
copyFilter |
private boolean |
copyProject |
static FilterProjectTransposeRule |
INSTANCE
The default instance of
FilterProjectTransposeRule . |
description, operands, relBuilderFactory
Modifier | Constructor and Description |
---|---|
|
FilterProjectTransposeRule(java.lang.Class<? extends Filter> filterClass,
java.lang.Class<? extends Project> projectClass,
boolean copyFilter,
boolean copyProject,
RelBuilderFactory relBuilderFactory)
Creates a FilterProjectTransposeRule.
|
|
FilterProjectTransposeRule(java.lang.Class<? extends Filter> filterClass,
RelFactories.FilterFactory filterFactory,
java.lang.Class<? extends Project> projectClass,
RelFactories.ProjectFactory projectFactory)
Deprecated.
|
|
FilterProjectTransposeRule(java.lang.Class<F> filterClass,
java.util.function.Predicate<? super F> filterPredicate,
java.lang.Class<P> projectClass,
java.util.function.Predicate<? super P> projectPredicate,
boolean copyFilter,
boolean copyProject,
RelBuilderFactory relBuilderFactory)
Creates a FilterProjectTransposeRule.
|
protected |
FilterProjectTransposeRule(RelOptRuleOperand operand,
boolean copyFilter,
boolean copyProject,
RelBuilderFactory relBuilderFactory) |
Modifier and Type | Method and Description |
---|---|
void |
onMatch(RelOptRuleCall call)
Receives notification about a rule match.
|
private RexNode |
simplifyFilterCondition(RexNode condition,
RelOptRuleCall call)
Simplifies the filter condition using a simplifier created by the
information in the current call.
|
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
public static final FilterProjectTransposeRule INSTANCE
FilterProjectTransposeRule
.
It matches any kind of Join
or
Filter
, and generates the same kind of
Join and Filter.
It does not allow a Filter to be pushed past the Project if
there is a correlation condition
)
anywhere in the Filter, since in some cases it can prevent a
Correlate
from being de-correlated.
private final boolean copyFilter
private final boolean copyProject
public FilterProjectTransposeRule(java.lang.Class<? extends Filter> filterClass, java.lang.Class<? extends Project> projectClass, boolean copyFilter, boolean copyProject, RelBuilderFactory relBuilderFactory)
Equivalent to the rule created by
FilterProjectTransposeRule(Class, Predicate, Class, Predicate, boolean, boolean, RelBuilderFactory)
with some default predicates that do not allow a filter to be pushed
past the project if there is a correlation condition anywhere in the
filter (since in some cases it can prevent a
Correlate
from being de-correlated).
public FilterProjectTransposeRule(java.lang.Class<F> filterClass, java.util.function.Predicate<? super F> filterPredicate, java.lang.Class<P> projectClass, java.util.function.Predicate<? super P> projectPredicate, boolean copyFilter, boolean copyProject, RelBuilderFactory relBuilderFactory)
If copyFilter
is true, creates the same kind of Filter as
matched in the rule, otherwise it creates a Filter using the RelBuilder
obtained by the relBuilderFactory
.
Similarly for copyProject
.
Defining predicates for the Filter (using filterPredicate
)
and/or the Project (using projectPredicate
allows making the rule
more restrictive.
@Deprecated public FilterProjectTransposeRule(java.lang.Class<? extends Filter> filterClass, RelFactories.FilterFactory filterFactory, java.lang.Class<? extends Project> projectClass, RelFactories.ProjectFactory projectFactory)
protected FilterProjectTransposeRule(RelOptRuleOperand operand, boolean copyFilter, boolean copyProject, RelBuilderFactory relBuilderFactory)
public void onMatch(RelOptRuleCall call)
RelOptRule
call.rels
holds the set of relational
expressions which match the operands to the rule;
call.rels[0]
is the root expression.
Typically a rule would check that the nodes are valid matches, creates
a new expression, then calls back RelOptRuleCall.transformTo(org.apache.calcite.rel.RelNode, java.util.Map<org.apache.calcite.rel.RelNode, org.apache.calcite.rel.RelNode>)
to
register the expression.
onMatch
in class RelOptRule
call
- Rule callRelOptRule.matches(RelOptRuleCall)
private RexNode simplifyFilterCondition(RexNode condition, RelOptRuleCall call)
This method is an attempt to replicate the simplification behavior of
RelBuilder.filter(RexNode...)
which cannot be used in the case of
copying nodes. The main difference with the behavior of that method is that
it does not drop entirely the filter if the condition is always false.
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.