public enum RexUnknownAs extends java.lang.Enum<RexUnknownAs>
In particular, it deals with converting three-valued logic (TRUE, FALSE, UNKNOWN) to two-valued logic (TRUE, FALSE) for callers that treat the UNKNOWN value the same as TRUE or FALSE.
Sometimes the three-valued version of the expression is simpler (has a smaller expression tree) than the two-valued version. In these cases, favor simplicity over reduction to two-valued logic.
RexSimplify
Enum Constant and Description |
---|
FALSE
Policy that indicates that the expression is being used in a context
Where an UNKNOWN value is treated in the same way as FALSE.
|
TRUE
Policy that indicates that the expression is being used in a context
Where an UNKNOWN value is treated in the same way as TRUE.
|
UNKNOWN
Policy that indicates that the expression is being used in a context
Where an UNKNOWN value is treated as is.
|
Modifier and Type | Method and Description |
---|---|
static RexUnknownAs |
falseIf(boolean unknownAsFalse)
|
RexUnknownAs |
negate() |
boolean |
toBoolean() |
static RexUnknownAs |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static RexUnknownAs[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final RexUnknownAs FALSE
SQL predicates (WHERE
, ON
, HAVING
and
FILTER (WHERE)
clauses, a WHEN
clause of a CASE
expression, and in CHECK
constraints) all treat UNKNOWN as FALSE.
If the simplified expression never returns UNKNOWN, the simplifier
should make this clear to the caller, if possible, by marking its type as
BOOLEAN NOT NULL
.
public static final RexUnknownAs TRUE
This does not occur commonly in SQL. However, it occurs internally
during simplification. For example, "WHERE NOT expression
"
evaluates "NOT expression
" in a context that treats UNKNOWN as
FALSE; it is useful to consider that "expression
" is evaluated in a
context that treats UNKNOWN as TRUE.
If the simplified expression never returns UNKNOWN, the simplifier
should make this clear to the caller, if possible, by marking its type as
BOOLEAN NOT NULL
.
public static final RexUnknownAs UNKNOWN
BOOLEAN
BOOLEAN
expressions that are NOT NULL
BOOLEAN
expressions where UNKNOWN
should be
returned as is, for example in a SELECT
clause, or within an
expression such as an operand to AND
, OR
or
NOT
If you are unsure, use UNKNOWN. It is the safest option.
public static RexUnknownAs[] values()
for (RexUnknownAs c : RexUnknownAs.values()) System.out.println(c);
public static RexUnknownAs valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null@Nonnull public static RexUnknownAs falseIf(boolean unknownAsFalse)
public boolean toBoolean()
public RexUnknownAs negate()
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.