luoyuxia commented on code in PR #21663:
URL: https://github.com/apache/flink/pull/21663#discussion_r1098146682


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/type/NumericOrDefaultReturnTypeInference.java:
##########
@@ -56,11 +55,7 @@ public RelDataType inferReturnType(SqlOperatorBinding 
opBinding) {
         List<RelDataType> types = new ArrayList<>();
         for (int i = startTypeIdx; i < nOperands; i++) {
             RelDataType type = opBinding.getOperandType(i);
-            if (SqlTypeUtil.isNumeric(type)) {
-                types.add(type);
-            } else {
-                return opBinding.getOperandType(defaultTypeIdx);
-            }
+            types.add(type);

Review Comment:
   Do we really need to skip check for all type?
   
   In the fail case, if(b, 'xx', s), where the second operand is `char(2)`, the 
third operand is `string`, the it wll mistake the return type is `char(2)`, and 
then in the if code gen, it'll cast all operands to `char(2)`.
   Maybe we check 
   `if (SqlTypeUtil.isNumeric(type) || SqlTypeUtil.isCharacter(type))` in here?
   
   WDYT?



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to