public class Strong extends Object
A predicate is strong (or null-rejecting) if it is UNKNOWN if any of its inputs is 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
c1 = 1 OR c2 IS NULL is strong in [c1] (definitely null if c1
is null)
| Modifier and Type | Class and Description |
|---|---|
static class |
Strong.Policy
How whether an operator's operands are null affects whether a call to
that operator evaluates to null.
|
| Constructor and Description |
|---|
Strong() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
allStrong(List<RexNode> operands)
Returns whether all expressions in a list are strong.
|
boolean |
isNotTrue(RexNode node)
Returns whether an expression is definitely not true.
|
static boolean |
isNotTrue(RexNode node,
ImmutableBitSet nullColumns)
Returns whether the analyzed expression will definitely not return true
(equivalently, will definitely not return null or false) if
all of a given set of input columns are null.
|
boolean |
isNull(RexInputRef ref)
Returns whether a given input is definitely null.
|
boolean |
isNull(RexNode node)
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 |
isStrong(RexNode e)
Returns whether a given expression is strong.
|
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 |
policy(RexNode rexNode)
Returns how to deduce whether a particular
RexNode expression is null,
given whether its arguments are null. |
static Strong.Policy |
policy(SqlKind kind)
Deprecated.
|
static Strong.Policy |
policy(SqlOperator operator)
Returns how to deduce whether a particular
SqlOperator expression is null,
given whether its arguments are null. |
public static Strong of(ImmutableBitSet nullColumns)
public static boolean isNull(RexNode node, ImmutableBitSet nullColumns)
public static boolean isNotTrue(RexNode node, ImmutableBitSet nullColumns)
@Deprecated public static Strong.Policy policy(SqlKind kind)
policy(RexNode) or policy(SqlOperator)public static Strong.Policy policy(RexNode rexNode)
RexNode expression is null,
given whether its arguments are null.public static Strong.Policy policy(SqlOperator operator)
SqlOperator expression is null,
given whether its arguments are null.public static boolean isStrong(RexNode e)
Examples:
c = 1 since it returns null if and only if
c is null
c IS NULL since it always returns TRUE
or FALSE
e - Expressionpublic static boolean allStrong(List<RexNode> operands)
public boolean isNotTrue(RexNode node)
public boolean isNull(RexNode node)
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
"if x is null, is x + y null?
public boolean isNull(RexInputRef ref)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.