caicancai commented on code in PR #4071:
URL: https://github.com/apache/calcite/pull/4071#discussion_r1864813931


##########
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:
   @NobiGo I think this issue has been discussed in jira
   https://issues.apache.org/jira/browse/CALCITE-6397
   



-- 
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]

Reply via email to