tanclary commented on code in PR #3286:
URL: https://github.com/apache/calcite/pull/3286#discussion_r1246896561


##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -7347,6 +7347,8 @@ private static void 
checkSubstringFunction(SqlOperatorFixture f) {
         "ab", "VARCHAR(3) NOT NULL");
     f.checkString("substring(x'aabbcc' from 1 for 2)",
         "aabb", "VARBINARY(3) NOT NULL");
+    f.checkString("substring('abc' from 2 for 2147483646)",

Review Comment:
   What are the bounds of the `FROM` and `FOR` arguments? Might be worth adding 
a test for that case as well.



##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -577,16 +577,18 @@ public static String substring(String c, int s) {
   /** SQL SUBSTRING(string FROM ... FOR ...) function. */
   public static String substring(String c, int s, int l) {
     int lc = c.length();
-    int e = s + l;
+    long e = (long) s + (long) l;

Review Comment:
   Should we adjust the other `substring()` signatures in this class as well 
for consistency?



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