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

[GitHub] [ignite-3] AMashenkov commented on a diff in pull request #2159: IGNITE-19341 Sql. Correctly process null`s in SUBSTRING

AMashenkov commented on code in PR #2159:
URL: https://github.com/apache/ignite-3/pull/2159#discussion_r1221658256


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java:
##########
@@ -285,16 +285,37 @@ public void testTypeOf() {
         assertThrowsWithCause(() -> sql("SELECT TYPEOF(SELECT 1, 2)"), CalciteContextException.class);
     }
 
+    /**
+     * Tests for {@code SUBSTRING(str, start[, length])} function.
+     */
+    @Test
+    public void testSubstring() {
+        assertQuery("SELECT SUBSTRING('1234567', 1, 3)").returns("123").check();
+        assertQuery("SELECT SUBSTRING('1234567', 2)").returns("234567").check();
+        assertQuery("SELECT SUBSTRING('1234567', -1)").returns("1234567").check();
+        assertQuery("SELECT SUBSTRING(1000, 1, 3)").returns("100").check();
+
+        assertQuery("SELECT SUBSTRING(NULL FROM 1 FOR 2)").returns(null).check();
+        assertQuery("SELECT SUBSTRING('text' FROM 1 FOR null)").returns(null).check();
+        assertQuery("SELECT SUBSTRING('test' FROM null FOR 2)").returns(null).check();
+
+        // uncomment after https://issues.apache.org/jira/browse/CALCITE-5708 was merged.

Review Comment:
   We don't track Calcite tickets. 
   Maybe there Ignite ticket to fix the issue or to bump Calcite dependency version?



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