You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2023/05/03 07:42:23 UTC

[GitHub] [ignite-3] lowka commented on a diff in pull request #2000: IGNITE-18761 Sql. TypeOf can short-circuit only when its argument is a constant expression.

lowka commented on code in PR #2000:
URL: https://github.com/apache/ignite-3/pull/2000#discussion_r1183341193


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java:
##########
@@ -267,16 +271,40 @@ public void testTypeOf() {
         assertQuery("SELECT TYPEOF('a'::varchar(1))").returns("VARCHAR(1)").check();
         assertQuery("SELECT TYPEOF(NULL)").returns("NULL").check();
         assertQuery("SELECT TYPEOF(NULL::VARCHAR(100))").returns("VARCHAR(100)").check();
+        // A compound expression
+        assertQuery("SELECT TYPEOF('abcd' || COALESCE('efg', ?))").withParams("2").returns("VARCHAR").check();
+
+        // An expression that produces an error
+        IgniteException failed = assertThrows(IgniteException.class, () -> assertQuery("SELECT typeof(CAST('NONE' as INTEGER))").check());
+        assertSame(NumberFormatException.class, failed.getCause().getClass(), "cause");
+        assertThat(failed.getCause().getMessage(), containsString("For input string: \"NONE\""));
+
         try {
             sql("SELECT TYPEOF()");
+            fail();

Review Comment:
   fixed.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org