caicancai commented on code in PR #4071:
URL: https://github.com/apache/calcite/pull/4071#discussion_r1864727497
##########
core/src/main/java/org/apache/calcite/sql/type/ReturnTypes.java:
##########
@@ -603,13 +603,21 @@ public static SqlCall stripSeparator(SqlCall call) {
}
/**
- * Type-inference strategy for NVL2 function. It returns the least
restrictive type
- * between the second and third operands.
- */
- public static final SqlReturnTypeInference NVL2_RESTRICTIVE = opBinding ->
- opBinding.getTypeFactory().leastRestrictive(
- Arrays.asList(opBinding.getOperandType(1),
- opBinding.getOperandType(2)));
+ * Type-inference strategy for NVL2 function.
+ * If the first operand is nullable,
+ * it returns the least restrictive type between the second and third
operands.
+ * If the first operand is non-nullable,
+ * it return the second operand type.
+ */
+ public static final SqlReturnTypeInference NVL2_RESTRICTIVE = opBinding -> {
Review Comment:
I remember that this function was adapted by me and it seems to comply with
Oracle's specifications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]