mihaibudiu commented on code in PR #3572:
URL: https://github.com/apache/calcite/pull/3572#discussion_r1421301053


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlSubstringFunction.java:
##########
@@ -109,17 +108,16 @@ public class SqlSubstringFunction extends SqlFunction {
     case 3:
       if (!CHECKER3
           .checkOperandTypes(callBinding, throwOnFailure)) {
+        if (throwOnFailure) {
+          throw callBinding.newValidationSignatureError();
+        }
         return false;
       }
-      // Reset the operands because they may be coerced during
-      // implicit type coercion.
-      final List<SqlNode> operands = callBinding.getCall().getOperandList();
       final RelDataType t1 = callBinding.getOperandType(1);
       final RelDataType t2 = callBinding.getOperandType(2);
-      if (SqlTypeUtil.inCharFamily(t1)) {
-        if (!SqlTypeUtil.isCharTypeComparable(callBinding, operands,
-            throwOnFailure)) {
-          return false;
+      if (!(SqlTypeUtil.isIntType(t1) || SqlTypeUtil.isNull(t1))) {

Review Comment:
   Without null you get a type error when you call the function with a NULL 
argument. The is a test for this case 



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