public class RelOptPredicateList
extends java.lang.Object
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
Filter(Scan(EMP), deptno < 10
,
predicates: [deptno < 10]
Scan(DEPT)
, predicates: []
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
.
Modifier and Type | Field and Description |
---|---|
com.google.common.collect.ImmutableMap<RexNode,RexNode> |
constantMap
A map of each (e, constant) pair that occurs within
pulledUpPredicates . |
static RelOptPredicateList |
EMPTY |
private static com.google.common.collect.ImmutableList<RexNode> |
EMPTY_LIST |
com.google.common.collect.ImmutableList<RexNode> |
leftInferredPredicates
Predicates that were inferred from the right input.
|
com.google.common.collect.ImmutableList<RexNode> |
pulledUpPredicates
Predicates that can be pulled up from the relational expression and its
inputs.
|
com.google.common.collect.ImmutableList<RexNode> |
rightInferredPredicates
Predicates that were inferred from the left input.
|
Modifier | Constructor and Description |
---|---|
private |
RelOptPredicateList(com.google.common.collect.ImmutableList<RexNode> pulledUpPredicates,
com.google.common.collect.ImmutableList<RexNode> leftInferredPredicates,
com.google.common.collect.ImmutableList<RexNode> rightInferredPredicates,
com.google.common.collect.ImmutableMap<RexNode,RexNode> constantMap) |
Modifier and Type | Method and Description |
---|---|
private static <E> com.google.common.collect.ImmutableList<E> |
concat(com.google.common.collect.ImmutableList<E> list1,
com.google.common.collect.ImmutableList<E> list2)
Concatenates two immutable lists, avoiding a copy it possible.
|
static RelOptPredicateList |
of(RexBuilder rexBuilder,
java.lang.Iterable<RexNode> pulledUpPredicates)
Creates a RelOptPredicateList with only pulled-up predicates, no inferred
predicates.
|
static RelOptPredicateList |
of(RexBuilder rexBuilder,
java.lang.Iterable<RexNode> pulledUpPredicates,
java.lang.Iterable<RexNode> leftInferredPredicates,
java.lang.Iterable<RexNode> rightInferredPredicates)
Creates a RelOptPredicateList for a join.
|
RelOptPredicateList |
shift(RexBuilder rexBuilder,
int offset) |
RelOptPredicateList |
union(RexBuilder rexBuilder,
RelOptPredicateList list) |
private static final com.google.common.collect.ImmutableList<RexNode> EMPTY_LIST
public static final RelOptPredicateList EMPTY
public final com.google.common.collect.ImmutableList<RexNode> pulledUpPredicates
public final com.google.common.collect.ImmutableList<RexNode> leftInferredPredicates
public final com.google.common.collect.ImmutableList<RexNode> rightInferredPredicates
public final com.google.common.collect.ImmutableMap<RexNode,RexNode> constantMap
pulledUpPredicates
.private RelOptPredicateList(com.google.common.collect.ImmutableList<RexNode> pulledUpPredicates, com.google.common.collect.ImmutableList<RexNode> leftInferredPredicates, com.google.common.collect.ImmutableList<RexNode> rightInferredPredicates, com.google.common.collect.ImmutableMap<RexNode,RexNode> constantMap)
public static RelOptPredicateList of(RexBuilder rexBuilder, java.lang.Iterable<RexNode> pulledUpPredicates)
Use this for relational expressions other than joins.
pulledUpPredicates
- Predicates that apply to the rows returned by the
relational expressionpublic static RelOptPredicateList of(RexBuilder rexBuilder, java.lang.Iterable<RexNode> pulledUpPredicates, java.lang.Iterable<RexNode> leftInferredPredicates, java.lang.Iterable<RexNode> rightInferredPredicates)
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
inputpublic RelOptPredicateList union(RexBuilder rexBuilder, RelOptPredicateList list)
private static <E> com.google.common.collect.ImmutableList<E> concat(com.google.common.collect.ImmutableList<E> list1, com.google.common.collect.ImmutableList<E> list2)
public RelOptPredicateList shift(RexBuilder rexBuilder, int offset)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.