Class BooleanArgumentWindowFunctions
CONDITIONAL_TRUE_EVENT CONDITIONAL_CHANGE_EVENT
b BOOLEAN column CE.B CE.B
NOT b / b AND b / TRUE as written as written
i > 1 a comparison CAST(CE.I > 1 AS BOOLEAN) CAST(CE.I > 1 AS BOOLEAN)
b IS NULL CAST(… AS BOOLEAN) CAST(… AS BOOLEAN)
STARTSWITH(t,'1') CAST(… AS BOOLEAN) CAST(… AS BOOLEAN)
t VARCHAR column CAST(CE.T AS BOOLEAN) CE.T
UPPER(t) a VARCHAR call CAST(… AS BOOLEAN) UPPER(CE.T)
i + 1 arithmetic — CE.I + 1
★ TWO SEPARATE RULES PRODUCE THAT TABLE, and they have to be kept apart:
1. A BOOLEAN-VALUED EXPRESSION THAT IS NOT ONE OF THE LOGICAL NODES is materialised as a cast, by BOTH functions. A comparison, an IS NULL and a boolean-returning call are all booleans already, and all three are cast anyway; a BOOLEAN column, a boolean literal and NOT / AND / OR are not. So the cast is not "the type had to change" — it is the plan spelling out a predicate it did not build from its own logical vocabulary.
2. THE PARAMETER'S OWN TYPE. CONDITIONAL_TRUE_EVENT counts how often a PREDICATE holds, so a non-boolean argument is converted and the conversion is printed. CONDITIONAL_CHANGE_EVENT counts how often a VALUE changes and takes any type, so it converts nothing — which is why the last three rows of the table differ.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanWhether this function CONVERTS its argument to a boolean — rule 2, which is CONDITIONAL_TRUE_EVENT alone.static booleanWhether this function's echo spells out a boolean argument it did not build itself — rule 1.
-
Method Details
-
spellsOutABooleanArgument
Whether this function's echo spells out a boolean argument it did not build itself — rule 1. Measured for these two; every other window function's echo is left as it was.- Parameters:
name- the upper-cased function name- Returns:
- true for the two conditional-event functions
-
coercesArgumentToBoolean
Whether this function CONVERTS its argument to a boolean — rule 2, which is CONDITIONAL_TRUE_EVENT alone.- Parameters:
name- the upper-cased function name- Returns:
- true when the parameter is a predicate rather than a value
-