public class RexSimplify extends Object
Copied to fix Calcite 1.26 bugs, should be removed for the next Calcite upgrade.
Changes (line numbers are from the original RexSimplify file):
| 限定符和类型 | 字段和说明 |
|---|---|
org.apache.calcite.rex.RexBuilder |
rexBuilder |
| 构造器和说明 |
|---|
RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder,
boolean unknownAsFalse,
org.apache.calcite.rex.RexExecutor executor)
已过时。
|
RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder,
org.apache.calcite.plan.RelOptPredicateList predicates,
boolean unknownAsFalse,
org.apache.calcite.rex.RexExecutor executor)
已过时。
|
RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder,
org.apache.calcite.plan.RelOptPredicateList predicates,
org.apache.calcite.rex.RexExecutor executor)
Creates a RexSimplify.
|
| 限定符和类型 | 方法和说明 |
|---|---|
org.apache.calcite.rex.RexNode |
removeNullabilityCast(org.apache.calcite.rex.RexNode e)
Removes any casts that change nullability but not type.
|
org.apache.calcite.rex.RexNode |
simplify(org.apache.calcite.rex.RexNode e)
Simplifies a boolean expression.
|
org.apache.calcite.rex.RexNode |
simplifyAnd(org.apache.calcite.rex.RexCall e)
已过时。
|
org.apache.calcite.rex.RexNode |
simplifyAnds(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
已过时。
|
org.apache.calcite.rex.RexNode |
simplifyFilterPredicates(Iterable<? extends org.apache.calcite.rex.RexNode> predicates)
Combines predicates AND, optimizes, and returns null if the result is always false.
|
org.apache.calcite.rex.RexNode |
simplifyOr(org.apache.calcite.rex.RexCall call)
已过时。
|
org.apache.calcite.rex.RexNode |
simplifyOrs(List<org.apache.calcite.rex.RexNode> terms)
已过时。
|
org.apache.calcite.rex.RexNode |
simplifyPreservingType(org.apache.calcite.rex.RexNode e)
Simplifies a boolean expression, always preserving its type and its nullability.
|
org.apache.calcite.rex.RexNode |
simplifyPreservingType(org.apache.calcite.rex.RexNode e,
org.apache.calcite.rex.RexUnknownAs unknownAs,
boolean matchNullability) |
org.apache.calcite.rex.RexNode |
simplifyUnknownAs(org.apache.calcite.rex.RexNode e,
org.apache.calcite.rex.RexUnknownAs unknownAs)
As
simplify(RexNode), but specifying how UNKNOWN values are to be treated. |
org.apache.calcite.rex.RexNode |
simplifyUnknownAsFalse(org.apache.calcite.rex.RexNode e)
As
simplify(RexNode), but for a boolean expression for which a result of UNKNOWN
will be treated as FALSE. |
RexSimplify |
withParanoid(boolean paranoid)
Returns a RexSimplify the same as this but which verifies that the expression before and
after simplification are equivalent.
|
RexSimplify |
withPredicates(org.apache.calcite.plan.RelOptPredicateList predicates)
Returns a RexSimplify the same as this but with a specified
predicates value. |
RexSimplify |
withUnknownAsFalse(boolean unknownAsFalse)
已过时。
Use methods with a
RexUnknownAs argument, such as simplify(RexNode, RexUnknownAs). |
public RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder,
org.apache.calcite.plan.RelOptPredicateList predicates,
org.apache.calcite.rex.RexExecutor executor)
rexBuilder - Rex builderpredicates - Predicates known to hold on input fieldsexecutor - Executor for constant reduction, not null@Deprecated public RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder, boolean unknownAsFalse, org.apache.calcite.rex.RexExecutor executor)
@Deprecated public RexSimplify(org.apache.calcite.rex.RexBuilder rexBuilder, org.apache.calcite.plan.RelOptPredicateList predicates, boolean unknownAsFalse, org.apache.calcite.rex.RexExecutor executor)
@Deprecated public RexSimplify withUnknownAsFalse(boolean unknownAsFalse)
RexUnknownAs argument, such as simplify(RexNode, RexUnknownAs).defaultUnknownAs value.public RexSimplify withPredicates(org.apache.calcite.plan.RelOptPredicateList predicates)
predicates value.public RexSimplify withParanoid(boolean paranoid)
public org.apache.calcite.rex.RexNode simplifyPreservingType(org.apache.calcite.rex.RexNode e)
This is useful if you are simplifying expressions in a Project.
public org.apache.calcite.rex.RexNode simplifyPreservingType(org.apache.calcite.rex.RexNode e,
org.apache.calcite.rex.RexUnknownAs unknownAs,
boolean matchNullability)
public org.apache.calcite.rex.RexNode simplify(org.apache.calcite.rex.RexNode e)
In particular:
simplify(x = 1 AND y = 2 AND NOT x = 1) returns y = 2
simplify(x = 1 AND FALSE) returns FALSE
Handles UNKNOWN values using the policy specified when you created this RexSimplify. Unless you used a deprecated constructor, that policy is RexUnknownAs.UNKNOWN.
If the expression is a predicate in a WHERE clause, consider instead using simplifyUnknownAsFalse(RexNode).
e - Expression to simplifypublic final org.apache.calcite.rex.RexNode simplifyUnknownAsFalse(org.apache.calcite.rex.RexNode e)
simplify(RexNode), but for a boolean expression for which a result of UNKNOWN
will be treated as FALSE.
Use this form for expressions on a WHERE, ON, HAVING or FILTER(WHERE) clause.
This may allow certain additional simplifications. A result of UNKNOWN may yield FALSE, however it may still yield UNKNOWN. (If the simplified expression has type BOOLEAN NOT NULL, then of course it can only return FALSE.)
public org.apache.calcite.rex.RexNode simplifyUnknownAs(org.apache.calcite.rex.RexNode e,
org.apache.calcite.rex.RexUnknownAs unknownAs)
simplify(RexNode), but specifying how UNKNOWN values are to be treated.
If UNKNOWN is treated as FALSE, this may allow certain additional simplifications. A result of UNKNOWN may yield FALSE, however it may still yield UNKNOWN. (If the simplified expression has type BOOLEAN NOT NULL, then of course it can only return FALSE.)
@Deprecated public org.apache.calcite.rex.RexNode simplifyAnds(Iterable<? extends org.apache.calcite.rex.RexNode> nodes)
@Deprecated public org.apache.calcite.rex.RexNode simplifyAnd(org.apache.calcite.rex.RexCall e)
@Deprecated public org.apache.calcite.rex.RexNode simplifyOr(org.apache.calcite.rex.RexCall call)
@Deprecated public org.apache.calcite.rex.RexNode simplifyOrs(List<org.apache.calcite.rex.RexNode> terms)
public org.apache.calcite.rex.RexNode removeNullabilityCast(org.apache.calcite.rex.RexNode e)
For example, CAST(1 = 0 AS BOOLEAN) becomes 1 = 0.
public org.apache.calcite.rex.RexNode simplifyFilterPredicates(Iterable<? extends org.apache.calcite.rex.RexNode> predicates)
The expression is simplified on the assumption that an UNKNOWN value is always treated as FALSE. Therefore the simplified expression may sometimes evaluate to FALSE where the original expression would evaluate to UNKNOWN.
predicates - Filter condition predicatesCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.