juntaozhang commented on code in PR #4353:
URL: https://github.com/apache/calcite/pull/4353#discussion_r2071255433


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/TypeCoercionImpl.java:
##########
@@ -383,12 +383,16 @@ protected boolean booleanEquality(SqlCallBinding binding,
     return false;
   }
 
+  @Deprecated @Override public boolean caseWhenCoercion(SqlCallBinding 
callBinding) {
+    return caseOrEquivalentCoercion(callBinding);
+  }
+
   /**
    * CASE WHEN and COALESCE type coercion, collect all the branches types 
including then
    * operands and else operands to find a common type, then cast the operands 
to the common type
    * when needed.
    */
-  @Override public boolean caseWhenCoercion(SqlCallBinding callBinding) {
+  @Override public boolean caseOrEquivalentCoercion(SqlCallBinding 
callBinding) {

Review Comment:
   > do we need to worry about NULLIF? Can you take a look to see whether 
that's also expanded?
   
   After my study, `NULLIF ` `returnType` use `ARG0_FORCE_NULLABLE`, it means 
using first arg type , but `COALESCE` is `LEAST_RESTRICTIVE` need 
`inferReturnType`. 
   So, typeCoercion only happen in `case when` and `COALESCE`.
   
   `NULLIF (V1, V2) `  definiton:
   ```
   CASE WHEN V1=V2 THEN NULL ELSE V1 END
   ```



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