mihaibudiu commented on code in PR #3286:
URL: https://github.com/apache/calcite/pull/3286#discussion_r1246930889
##########
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:
Here's what Postgres says when you try it:
`Query Error: error: function substring(unknown, integer, bigint) does not
exist`
This is a reasonable solution.
This is tied with the way Calcite does type inference and implicit cast
insertion, which I can't claim I understand well.
An alternative approach would be to implicitly cast the bigint to an int,
and if that requires truncation probably a warning should be issued.
Currently it looks to me like the constant folding fails but the error that
causes the failure is lost when handling the exception, probably because of the
use of Janino which entails dynamic code generation.
--
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]