asolimando commented on code in PR #3522:
URL: https://github.com/apache/calcite/pull/3522#discussion_r1453272159


##########
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:
   @snuyanzin, I think it should fail as you say, there seems to be something 
wrong.
   
   I also tried changing `runtime` to `false` just to see, in this way it 
always fails (with a cast with overflow, and cast without), I guess there is 
something broken in the test auxiliary methods we rely on here.
   
   The source of the problem lies outside the present PR, but it's nonetheless 
a blocker for merging (if confirmed), as we can't rely on the unit tests.
   
   Maybe @mihaibudiu has more familiarity with this part of the code, and can 
shed some light.



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