public class RexImplicationChecker extends Object
If A ⇒ B, whenever A is true, B will be true also.
For example:
| Modifier and Type | Class and Description |
|---|---|
private static class |
RexImplicationChecker.InputRefUsage<T1,T2>
Usage of a
RexInputRef in an expression. |
private static class |
RexImplicationChecker.InputUsageFinder
Visitor that builds a usage map of inputs used by an expression.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) RexBuilder |
builder |
(package private) RexExecutorImpl |
executor |
private static CalciteLogger |
LOGGER |
(package private) RelDataType |
rowType |
| Constructor and Description |
|---|
RexImplicationChecker(RexBuilder builder,
RexExecutorImpl executor,
RelDataType rowType) |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
checkSupport(RexImplicationChecker.InputUsageFinder firstUsageFinder,
RexImplicationChecker.InputUsageFinder secondUsageFinder)
Looks at the usage of variables in first and second conjunction to decide
whether this kind of expression is currently supported for proving first
implies second.
|
boolean |
implies(RexNode first,
RexNode second)
Checks if condition first implies (⇒) condition second.
|
private boolean |
implies2(RexNode first,
RexNode second)
Returns whether the predicate
first (not a conjunction)
implies second. |
private boolean |
impliesAny(RexNode first,
List<RexNode> seconds)
Returns whether the predicate
first implies (⇒)
at least one predicate in seconds. |
private boolean |
impliesConjunction(RexNode first,
RexNode second)
Returns whether the predicate
first implies second (both
may be conjunctions). |
private boolean |
isEquivalentOp(SqlKind fKind,
SqlKind sKind) |
private boolean |
isOppositeOp(SqlKind fKind,
SqlKind sKind) |
private boolean |
isSatisfiable(RexNode second,
DataContext dataValues) |
private boolean |
isSupportedUnaryOperators(SqlKind kind) |
private boolean |
validate(RexNode first,
RexNode second) |
private static final CalciteLogger LOGGER
final RexBuilder builder
final RexExecutorImpl executor
final RelDataType rowType
public RexImplicationChecker(RexBuilder builder, RexExecutorImpl executor, RelDataType rowType)
public boolean implies(RexNode first, RexNode second)
This reduces to SAT problem which is NP-Complete. When this method says first implies second then it is definitely true. But it cannot prove that first does not imply second.
first - first conditionsecond - second conditionprivate boolean impliesAny(RexNode first, List<RexNode> seconds)
first implies (⇒)
at least one predicate in seconds.private boolean impliesConjunction(RexNode first, RexNode second)
first implies second (both
may be conjunctions).private boolean implies2(RexNode first, RexNode second)
first (not a conjunction)
implies second.private boolean isSatisfiable(RexNode second, DataContext dataValues)
private boolean checkSupport(RexImplicationChecker.InputUsageFinder firstUsageFinder, RexImplicationChecker.InputUsageFinder secondUsageFinder)
private boolean isSupportedUnaryOperators(SqlKind kind)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.