snuyanzin commented on code in PR #3522:
URL: https://github.com/apache/calcite/pull/3522#discussion_r1453252536
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -13695,6 +13697,43 @@ private static void
checkLogicalOrFunc(SqlOperatorFixture f) {
}
}
+ /**
+ * Test cases for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6111">[CALCITE-6111]
+ * Explicit cast from expression to numeric type doesn't check overflow</a>.
*/
+ @Test public void testOverflow() {
+ final SqlOperatorFixture f = fixture();
+ f.checkFails(String.format(Locale.US, "SELECT cast(%d+30 as tinyint)",
Byte.MAX_VALUE),
+ ".* out of range", true);
Review Comment:
I tried to see what happens if I locally change expectedError to something
else...
Surprisingly the tests continue passing
it seems that the reason is that this method is called
https://github.com/apache/calcite/blob/0bec957071468a2e54a22519290ac101a752fcad/testkit/src/main/java/org/apache/calcite/test/SqlOperatorFixtureImpl.java#L157-L171
which means it checks for failure only if it is not runtime...
so it could be any expected message and any number under `cast` and it
continues passing...
Or did I do something wrong?
--
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]