Package org.apache.calcite.plan
Class Strong
java.lang.Object
org.apache.calcite.plan.Strong
Utilities for strong predicates.
A predicate is strong (or null-rejecting) with regard to selected subset of inputs if it is UNKNOWN if all inputs in selected subset are UNKNOWN.
By the way, UNKNOWN is just the boolean form of NULL.
Examples:
UNKNOWN
is strong in [] (definitely null)c = 1
is strong in [c] (definitely null if and only if c is null)c IS NULL
is not strong (always returns TRUE or FALSE, never null)p1 AND p2
is strong in [p1, p2] (definitely null if either p1 is null or p2 is null)p1 OR p2
is strong if p1 and p2 are strong
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
How whether an operator's operands are null affects whether a call to that operator evaluates to null. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Returns whether all expressions in a list are strong.boolean
Returns whether the analyzed expression will definitely not return true (equivalently, will definitely return null or false).static boolean
isNotTrue
(RexNode node, ImmutableBitSet nullColumns) Returns whether the analyzed expression will definitely not return true (equivalently, will definitely return null or false) if all of a given set of input columns are null.boolean
isNull
(RexFieldAccess ref) Returns whether a given field is definitely null.boolean
isNull
(RexInputRef ref) Returns whether a given input is definitely null.boolean
Returns whether an expression is definitely null.static boolean
isNull
(RexNode node, ImmutableBitSet nullColumns) Returns whether the analyzed expression will definitely return null if all of a given set of input columns are null.static boolean
Returns whether a given expression is strong.static Strong
of
(com.google.common.collect.ImmutableSet<RexFieldAccess> nullFields) Returns a checker that consults a set to find out whether particular field may be null.static Strong
of
(ImmutableBitSet nullColumns) Returns a checker that consults a bit set to find out whether particular inputs may be null.static Strong.Policy
Returns how to deduce whether a particularRexNode
expression is null, given whether its arguments are null.static Strong.Policy
Deprecated.static Strong.Policy
policy
(SqlOperator operator) Returns how to deduce whether a particularSqlOperator
expression is null, given whether its arguments are null.
-
Constructor Details
-
Strong
public Strong()
-
-
Method Details
-
of
Returns a checker that consults a bit set to find out whether particular inputs may be null. -
of
Returns a checker that consults a set to find out whether particular field may be null. -
isNull
Returns whether the analyzed expression will definitely return null if all of a given set of input columns are null. -
isNotTrue
Returns whether the analyzed expression will definitely not return true (equivalently, will definitely return null or false) if all of a given set of input columns are null. -
policy
Deprecated.Returns how to deduce whether a particular kind of expression is null, given whether its arguments are null. -
policy
Returns how to deduce whether a particularRexNode
expression is null, given whether its arguments are null. -
policy
Returns how to deduce whether a particularSqlOperator
expression is null, given whether its arguments are null. -
isStrong
Returns whether a given expression is strong.Examples:
- Returns true for
c = 1
since it returns null if and only if c is null - Returns false for
c IS NULL
since it always returns TRUE or FALSE
- Parameters:
e
- Expression- Returns:
- true if the expression is strong, false otherwise
- Returns true for
-
allStrong
Returns whether all expressions in a list are strong. -
isNotTrue
Returns whether the analyzed expression will definitely not return true (equivalently, will definitely return null or false). -
isNull
Returns whether an expression is definitely null.The answer is based on calls to
isNull(org.apache.calcite.rex.RexNode, org.apache.calcite.util.ImmutableBitSet)
for its constituent expressions, and you may override methods to test hypotheses such as "ifx
is null, isx + y
null? -
isNull
Returns whether a given input is definitely null. -
isNull
Returns whether a given field is definitely null.
-
policy(RexNode)
orpolicy(SqlOperator)