Class RelOptPredicateList
Pulled up predicates (field pulledUpPredicates
are
predicates that apply to every row output by the relational expression. They
are inferred from the input relational expression(s) and the relational
operator.
For example, if you apply Filter(x > 1)
to a relational
expression that has a predicate y < 10
then the pulled up predicates
for the Filter are [y < 10, x > 1]
.
Inferred predicates only apply to joins. If there there is a predicate on the left input to a join, and that predicate is over columns used in the join condition, then a predicate can be inferred on the right input to the join. (And vice versa.)
For example, in the query
SELECT *we have
FROM emp
JOIN dept ON emp.deptno = dept.deptno WHERE emp.gender = 'F' AND emp.deptno < 10
- left:
Filter(Scan(EMP), deptno < 10
, predicates:[deptno < 10]
- right:
Scan(DEPT)
, predicates:[]
- join:
Join(left, right, emp.deptno = dept.deptno
, leftInferredPredicates: [], rightInferredPredicates: [deptno < 10], pulledUpPredicates: [emp.gender = 'F', emp.deptno < 10, emp.deptno = dept.deptno, dept.deptno < 10]
Note that the predicate from the left input appears in
rightInferredPredicates
. Predicates from several sources appear in
pulledUpPredicates
.
-
Field Summary
Modifier and TypeFieldDescriptionA map of each (e, constant) pair that occurs withinpulledUpPredicates
.static final RelOptPredicateList
final com.google.common.collect.ImmutableList<RexNode>
Predicates that were inferred from the right input.final com.google.common.collect.ImmutableList<RexNode>
Predicates that can be pulled up from the relational expression and its inputs.final com.google.common.collect.ImmutableList<RexNode>
Predicates that were inferred from the left input. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns whether an expression is effectively NOT NULL due to ane IS NOT NULL
condition in this predicate list.static boolean
isEmpty
(@Nullable RelOptPredicateList value) Returns true if given predicate list is empty.static RelOptPredicateList
of
(RexBuilder rexBuilder, Iterable<RexNode> pulledUpPredicates) Creates a RelOptPredicateList with only pulled-up predicates, no inferred predicates.static RelOptPredicateList
of
(RexBuilder rexBuilder, Iterable<RexNode> pulledUpPredicates, Iterable<RexNode> leftInferredPredicates, Iterable<RexNode> rightInferredPredicates) Creates a RelOptPredicateList for a join.shift
(RexBuilder rexBuilder, int offset) toString()
union
(RexBuilder rexBuilder, RelOptPredicateList list)
-
Field Details
-
EMPTY
-
pulledUpPredicates
Predicates that can be pulled up from the relational expression and its inputs. -
leftInferredPredicates
Predicates that were inferred from the right input. Empty if the relational expression is not a join. -
rightInferredPredicates
Predicates that were inferred from the left input. Empty if the relational expression is not a join. -
constantMap
A map of each (e, constant) pair that occurs withinpulledUpPredicates
.
-
-
Method Details
-
of
Creates a RelOptPredicateList with only pulled-up predicates, no inferred predicates.Use this for relational expressions other than joins.
- Parameters:
pulledUpPredicates
- Predicates that apply to the rows returned by the relational expression
-
isEmpty
Returns true if given predicate list is empty.- Parameters:
value
- input predicate list- Returns:
- true if all the predicates are empty or if the argument is null
-
of
public static RelOptPredicateList of(RexBuilder rexBuilder, Iterable<RexNode> pulledUpPredicates, Iterable<RexNode> leftInferredPredicates, Iterable<RexNode> rightInferredPredicates) Creates a RelOptPredicateList for a join.- Parameters:
rexBuilder
- Rex builderpulledUpPredicates
- Predicates that apply to the rows returned by the relational expressionleftInferredPredicates
- Predicates that were inferred from the right inputrightInferredPredicates
- Predicates that were inferred from the left input
-
toString
-
union
-
shift
-
isEffectivelyNotNull
Returns whether an expression is effectively NOT NULL due to ane IS NOT NULL
condition in this predicate list.
-