Enum RexUnknownAs
- All Implemented Interfaces:
Serializable
,Comparable<RexUnknownAs>
,Constable
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.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionPolicy that indicates that the expression is being used in a context Where an UNKNOWN value is treated in the same way as FALSE.Policy that indicates that the expression is being used in a context Where an UNKNOWN value is treated in the same way as TRUE.Policy that indicates that the expression is being used in a context Where an UNKNOWN value is treated as is. -
Method Summary
Modifier and TypeMethodDescriptionstatic RexUnknownAs
falseIf
(boolean unknownAsFalse) negate()
or
(RexUnknownAs other) Combines this with anotherRexUnknownAs
in the same way as the three-valued logic of OR.boolean
static RexUnknownAs
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.
-
Enum Constant Details
-
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. Therefore, when simplifying the expression, it is acceptable for the simplified expression to evaluate to FALSE in some situations where the original expression would evaluate to UNKNOWN.SQL predicates (
WHERE
,ON
,HAVING
andFILTER (WHERE)
clauses, aWHEN
clause of aCASE
expression, and inCHECK
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
. -
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. Therefore, when simplifying the expression, it is acceptable for the simplified expression to evaluate to TRUE in some situations where the original expression would evaluate to UNKNOWN.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
. -
UNKNOWN
Policy that indicates that the expression is being used in a context Where an UNKNOWN value is treated as is. This occurs:- In any expression whose type is not
BOOLEAN
- In
BOOLEAN
expressions that areNOT NULL
- In
BOOLEAN
expressions whereUNKNOWN
should be returned as is, for example in aSELECT
clause, or within an expression such as an operand toAND
,OR
orNOT
If you are unsure, use UNKNOWN. It is the safest option.
- In any expression whose type is not
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
falseIf
-
toBoolean
public boolean toBoolean() -
negate
-
or
Combines this with anotherRexUnknownAs
in the same way as the three-valued logic of OR.For example,
TRUE or FALSE
returnsTRUE
;FALSE or UNKNOWN
returnsUNKNOWN
.
-