You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2021/08/04 07:28:56 UTC

[ignite] branch sql-calcite updated: IGNITE-15002 Fix functions fail on NULL constant - Fixes #9294.

This is an automated email from the ASF dual-hosted git repository.

alexpl pushed a commit to branch sql-calcite
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/sql-calcite by this push:
     new e546c50  IGNITE-15002 Fix functions fail on NULL constant - Fixes #9294.
e546c50 is described below

commit e546c506fe65f44c85afe8a3566000876c6b2a40
Author: Aleksey Plekhanov <pl...@gmail.com>
AuthorDate: Wed Aug 4 10:26:44 2021 +0300

    IGNITE-15002 Fix functions fail on NULL constant - Fixes #9294.
    
    Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
 .../query/calcite/exec/exp/ConverterUtils.java     |   5 +-
 .../processors/query/calcite/FunctionsTest.java    |  16 ++
 .../test/sql/function/numeric/test_truncate.test   |   5 +
 .../sql/function/numeric/test_truncate.test_ignore |   9 -
 .../test/sql/function/string/test_caseconvert.test |   7 +
 .../function/string/test_caseconvert.test_ignore   |  70 --------
 .../src/test/sql/function/string/test_initcap.test |   5 +
 .../sql/function/string/test_initcap.test_ignore   |   9 -
 .../src/test/sql/function/string/test_left.test    |  11 ++
 .../test/sql/function/string/test_left.test_ignore |   1 -
 .../src/test/sql/function/string/test_repeat.test  |   6 +-
 .../sql/function/string/test_repeat.test_ignore    |  59 -------
 .../src/test/sql/function/string/test_reverse.test |   6 +-
 .../sql/function/string/test_reverse.test_ignore   |  50 ------
 .../src/test/sql/function/string/test_right.test   |  11 ++
 .../sql/function/string/test_right.test_ignore     |   1 -
 .../test/sql/function/string/test_substring.test   |  57 ++++++
 .../sql/function/string/test_substring.test_ignore | 192 ---------------------
 18 files changed, 121 insertions(+), 399 deletions(-)

diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
index 39c2c17..8a3162d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
@@ -205,6 +205,9 @@ public class ConverterUtils {
         if (!Types.needTypeCast(fromType, toType))
           return operand;
 
+        if (toType == Void.class)
+            return RexImpTable.NULL_EXPR;
+
         if (toType == BigDecimal.class)
             throw new AssertionError("For conversion to decimal, ConverterUtils#convertToDecimal method should be used instead.");
 
@@ -240,8 +243,6 @@ public class ConverterUtils {
             }
             if (toBox != null) {
                 switch (toBox) {
-                    case VOID:
-                        return Expressions.constant(null);
                     case CHAR:
                         // Generate "SqlFunctions.toCharBoxed(x)".
                         return Expressions.call(
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/FunctionsTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/FunctionsTest.java
index e45c1b6..11c80d1 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/FunctionsTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/FunctionsTest.java
@@ -206,6 +206,22 @@ public class FunctionsTest extends GridCommonAbstractTest {
         checkQuery("SELECT 4 % 2").returns(0).check();
         checkQuery("SELECT NULL % 2").returns(new Object[] { null }).check();
         checkQuery("SELECT 3 % NULL::int").returns(new Object[] { null }).check();
+        checkQuery("SELECT 3 % NULL").returns(new Object[] { null }).check();
+    }
+
+    /** */
+    @Test
+    public void testNullFunctionArguments() {
+        // Don't infer result data type from arguments (result is always INTEGER_NULLABLE).
+        checkQuery("SELECT ASCII(NULL)").returns(new Object[] { null }).check();
+        // Inferring result data type from first STRING argument.
+        checkQuery("SELECT REPLACE(NULL, '1', '2')").returns(new Object[] { null }).check();
+        // Inferring result data type from both arguments.
+        checkQuery("SELECT MOD(1, null)").returns(new Object[] { null }).check();
+        // Inferring result data type from first NUMERIC argument.
+        checkQuery("SELECT TRUNCATE(NULL, 0)").returns(new Object[] { null }).check();
+        // Inferring arguments data types and then inferring result data type from all arguments.
+        checkQuery("SELECT FALSE AND NULL").returns(false).check();
     }
 
     /** */
diff --git a/modules/calcite/src/test/sql/function/numeric/test_truncate.test b/modules/calcite/src/test/sql/function/numeric/test_truncate.test
index 266aa48..2a94fe3 100644
--- a/modules/calcite/src/test/sql/function/numeric/test_truncate.test
+++ b/modules/calcite/src/test/sql/function/numeric/test_truncate.test
@@ -37,3 +37,8 @@ query T
 SELECT TRUNCATE(-123.345, 0)
 ----
 -123
+
+query T
+SELECT TRUNCATE(null, 0)
+----
+NULL
diff --git a/modules/calcite/src/test/sql/function/numeric/test_truncate.test_ignore b/modules/calcite/src/test/sql/function/numeric/test_truncate.test_ignore
deleted file mode 100644
index bd361e3..0000000
--- a/modules/calcite/src/test/sql/function/numeric/test_truncate.test_ignore
+++ /dev/null
@@ -1,9 +0,0 @@
-# name: test/sql/function/numeric/test_truncate.test
-# description: Test TRUNCATE function
-# group: [numeric]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15112
-
-query T
-SELECT TRUNCATE(null, 0)
-----
-NULL
diff --git a/modules/calcite/src/test/sql/function/string/test_caseconvert.test b/modules/calcite/src/test/sql/function/string/test_caseconvert.test
index bad26aa..e24433e 100644
--- a/modules/calcite/src/test/sql/function/string/test_caseconvert.test
+++ b/modules/calcite/src/test/sql/function/string/test_caseconvert.test
@@ -2,6 +2,13 @@
 # description: UPPER/LOWER test
 # group: [string]
 
+# test NULL constant
+query TT
+select UPPER(NULL), LOWER(NULL)
+----
+NULL
+NULL
+
 # unicode
 query TTTT
 select UPPER('áaaá'), UPPER('ö'), LOWER('S̈'), UPPER('ω')
diff --git a/modules/calcite/src/test/sql/function/string/test_caseconvert.test_ignore b/modules/calcite/src/test/sql/function/string/test_caseconvert.test_ignore
deleted file mode 100644
index 2a7f012..0000000
--- a/modules/calcite/src/test/sql/function/string/test_caseconvert.test_ignore
+++ /dev/null
@@ -1,70 +0,0 @@
-# name: test/sql/function/string/test_caseconvert.test
-# description: UPPER/LOWER test
-# group: [string]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
-
-# test NULL constant
-query TT
-select UPPER(NULL), LOWER(NULL)
-----
-NULL
-NULL
-
-# unicode
-query TTTT
-select UPPER('áaaá'), UPPER('ö'), LOWER('S̈'), UPPER('ω')
-----
-ÁAAÁ	Ö	s̈	Ω
-
-# greek
-query TT
-SELECT UPPER('Αα Ββ Γγ Δδ Εε Ζζ  Ηη Θθ Ιι Κκ Λλ Μμ Νν Ξξ Οο Ππ Ρρ Σσς Ττ Υυ Φφ Χχ Ψψ Ωω'), LOWER('Αα Ββ Γγ Δδ Εε Ζζ  Ηη Θθ Ιι Κκ Λλ Μμ Νν Ξξ Οο Ππ Ρρ Σσς Ττ Υυ Φφ Χχ Ψψ Ωω')
-----
-ΑΑ ΒΒ ΓΓ ΔΔ ΕΕ ΖΖ  ΗΗ ΘΘ ΙΙ ΚΚ ΛΛ ΜΜ ΝΝ ΞΞ ΟΟ ΠΠ ΡΡ ΣΣΣ ΤΤ ΥΥ ΦΦ ΧΧ ΨΨ ΩΩ	αα ββ γγ δδ εε ζζ  ηη θθ ιι κκ λλ μμ νν ξξ οο ππ ρρ σσς ττ υυ φφ χχ ψψ ωω
-
-# test upper/lower on scalar values
-query TTT
-select UPPER(''), UPPER('hello'), UPPER('MotörHead')
-----
-(empty)	HELLO	MOTÖRHEAD
-
-query TTT
-select LOWER(''), LOWER('hello'), LOWER('MotörHead')
-----
-(empty)	hello	motörhead
-
-# test on entire tables
-statement ok
-CREATE TABLE strings(a VARCHAR, b VARCHAR)
-
-statement ok
-INSERT INTO strings VALUES ('Hello', 'World'), ('HuLlD', NULL), ('MotörHead','RÄcks')
-
-query T
-select UPPER(a) FROM strings ORDER BY a
-----
-HELLO
-HULLD
-MOTÖRHEAD
-
-query T
-select LOWER(a) FROM strings ORDER BY a
-----
-hello
-hulld
-motörhead
-
-query T
-select LOWER(b) FROM strings ORDER BY b
-----
-räcks
-world
-NULL
-
-# test with selection vector
-query TT
-select UPPER(a), LOWER(a) FROM strings WHERE b IS NOT NULL ORDER BY a
-----
-HELLO	hello
-MOTÖRHEAD	motörhead
-
diff --git a/modules/calcite/src/test/sql/function/string/test_initcap.test b/modules/calcite/src/test/sql/function/string/test_initcap.test
index 596cd71..d8e3cca 100644
--- a/modules/calcite/src/test/sql/function/string/test_initcap.test
+++ b/modules/calcite/src/test/sql/function/string/test_initcap.test
@@ -22,3 +22,8 @@ query T
 SELECT initcap('')
 ----
 (empty)
+
+query T
+SELECT initcap(null)
+----
+NULL
diff --git a/modules/calcite/src/test/sql/function/string/test_initcap.test_ignore b/modules/calcite/src/test/sql/function/string/test_initcap.test_ignore
deleted file mode 100644
index 61f0551..0000000
--- a/modules/calcite/src/test/sql/function/string/test_initcap.test_ignore
+++ /dev/null
@@ -1,9 +0,0 @@
-# name: test/sql/function/test/test_initcap.test
-# description: Just simple test to check support of INITCAP function
-# group: [string]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15111
-
-query T
-SELECT initcap(null)
-----
-NULL
diff --git a/modules/calcite/src/test/sql/function/string/test_left.test b/modules/calcite/src/test/sql/function/string/test_left.test
index bcf3c0d..e4c153d 100644
--- a/modules/calcite/src/test/sql/function/string/test_left.test
+++ b/modules/calcite/src/test/sql/function/string/test_left.test
@@ -14,6 +14,17 @@ SELECT LEFT('abcd', 0), LEFT('abc', -1), LEFT('abc', -2), LEFT('abc', -3), LEFT(
 ----
 (empty)	(empty)	(empty)	(empty)	(empty)
 
+# test LEFT on NULL values
+query TTT
+SELECT LEFT(NULL, 0), LEFT('abc', NULL), LEFT(NULL, NULL)
+----
+NULL	NULL	NULL
+
+query TTT
+SELECT LEFT(NULL, 0), LEFT('🦆ab', NULL), LEFT(NULL, NULL)
+----
+NULL	NULL	NULL
+
 # test on tables
 statement ok
 DROP TABLE IF EXISTS strings
diff --git a/modules/calcite/src/test/sql/function/string/test_left.test_ignore b/modules/calcite/src/test/sql/function/string/test_left.test_ignore
index 1095c82..da4f4b0 100644
--- a/modules/calcite/src/test/sql/function/string/test_left.test_ignore
+++ b/modules/calcite/src/test/sql/function/string/test_left.test_ignore
@@ -2,7 +2,6 @@
 # description: LEFT test
 # group: [string]
 # Ignored: https://issues.apache.org/jira/browse/IGNITE-14677
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
 # Ignored: https://issues.apache.org/jira/browse/IGNITE-15003
 
 # test LEFT on positive positions
diff --git a/modules/calcite/src/test/sql/function/string/test_repeat.test b/modules/calcite/src/test/sql/function/string/test_repeat.test
index 80e2479..1ed7684 100644
--- a/modules/calcite/src/test/sql/function/string/test_repeat.test
+++ b/modules/calcite/src/test/sql/function/string/test_repeat.test
@@ -3,10 +3,10 @@
 # group: [string]
 
 # test repeat on NULLs
-query T
-select REPEAT('MySQL', NULL)
+query TTT
+select REPEAT(NULL, NULL), REPEAT(NULL, 3), REPEAT('MySQL', NULL)
 ----
-NULL
+NULL	NULL	NULL
 
 # test repeat on scalars
 query TTTT
diff --git a/modules/calcite/src/test/sql/function/string/test_repeat.test_ignore b/modules/calcite/src/test/sql/function/string/test_repeat.test_ignore
deleted file mode 100644
index 7a01404..0000000
--- a/modules/calcite/src/test/sql/function/string/test_repeat.test_ignore
+++ /dev/null
@@ -1,59 +0,0 @@
-# name: test/sql/function/string/test_repeat.test
-# description: REPEAT test
-# group: [string]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
-
-# test repeat on NULLs
-query TTT
-select REPEAT(NULL, NULL), REPEAT(NULL, 3), REPEAT('MySQL', NULL)
-----
-NULL	NULL	NULL
-
-# test repeat on scalars
-query TTTT
-select REPEAT('', 3), REPEAT('MySQL', 3), REPEAT('MotörHead', 2), REPEAT('Hello', -1)
-----
-(empty)	MySQLMySQLMySQL	MotörHeadMotörHead	(empty)
-
-# test repeat on tables
-statement ok
-CREATE TABLE strings(id INTEGER, a VARCHAR, b VARCHAR)
-
-statement ok
-INSERT INTO strings VALUES (0, 'Hello', 'World'), (1, 'HuLlD', NULL), (2, 'MotörHead','RÄcks'), (3, '', NULL)
-
-query T
-select REPEAT(a, 3) FROM strings ORDER BY id
-----
-HelloHelloHello
-HuLlDHuLlDHuLlD
-MotörHeadMotörHeadMotörHead
-(empty)
-
-query T
-select REPEAT(b, 2) FROM strings ORDER BY id
-----
-WorldWorld
-NULL
-RÄcksRÄcks
-NULL
-
-query T
-select REPEAT(a, 4) FROM strings WHERE b IS NOT NULL ORDER BY id
-----
-HelloHelloHelloHello
-MotörHeadMotörHeadMotörHeadMotörHead
-
-# test incorrect usage of reverse
-statement error
-select REPEAT()
-
-statement error
-select REPEAT(1)
-
-statement error
-select REPEAT('hello', 'world')
-
-statement error
-select REPEAT('hello', 'world', 3)
-
diff --git a/modules/calcite/src/test/sql/function/string/test_reverse.test b/modules/calcite/src/test/sql/function/string/test_reverse.test
index 1c9426a..b3aad2f 100644
--- a/modules/calcite/src/test/sql/function/string/test_reverse.test
+++ b/modules/calcite/src/test/sql/function/string/test_reverse.test
@@ -3,10 +3,10 @@
 # group: [string]
 
 # test reverse on scalars
-query TTT
-select REVERSE(''), REVERSE('Hello'), REVERSE('MotörHead')
+query TTTT
+select REVERSE(''), REVERSE('Hello'), REVERSE('MotörHead'), REVERSE(NULL)
 ----
-(empty)	olleH	daeHrötoM
+(empty)	olleH	daeHrötoM	NULL
 
 # test reverse on tables
 statement ok
diff --git a/modules/calcite/src/test/sql/function/string/test_reverse.test_ignore b/modules/calcite/src/test/sql/function/string/test_reverse.test_ignore
deleted file mode 100644
index ae7c636..0000000
--- a/modules/calcite/src/test/sql/function/string/test_reverse.test_ignore
+++ /dev/null
@@ -1,50 +0,0 @@
-# name: test/sql/function/string/test_reverse.test
-# description: REVERSE test
-# group: [string]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
-
-# test reverse on scalars
-query TTTT
-select REVERSE(''), REVERSE('Hello'), REVERSE('MotörHead'), REVERSE(NULL)
-----
-(empty)	olleH	daeHrötoM	NULL
-
-# test reverse on tables
-statement ok
-CREATE TABLE strings(id INTEGER, a VARCHAR, b VARCHAR)
-
-statement ok
-INSERT INTO strings VALUES (0, 'Hello', 'World'), (1, 'HuLlD', NULL), (2, 'MotörHead','RÄcks'), (3, '', NULL)
-
-query T
-select REVERSE(a) FROM strings ORDER BY id
-----
-olleH
-DlLuH
-daeHrötoM
-(empty)
-
-query T
-select REVERSE(b) FROM strings ORDER BY id
-----
-dlroW
-NULL
-skcÄR
-NULL
-
-query T
-select REVERSE(a) FROM strings WHERE b IS NOT NULL ORDER BY id
-----
-olleH
-daeHrötoM
-
-# test incorrect usage of reverse
-statement error
-select REVERSE()
-
-statement error
-select REVERSE(1, 2)
-
-statement error
-select REVERSE('hello', 'world')
-
diff --git a/modules/calcite/src/test/sql/function/string/test_right.test b/modules/calcite/src/test/sql/function/string/test_right.test
index eb283cd..bbaf401 100644
--- a/modules/calcite/src/test/sql/function/string/test_right.test
+++ b/modules/calcite/src/test/sql/function/string/test_right.test
@@ -14,6 +14,17 @@ SELECT RIGHT('abcd', 0), RIGHT('abc', -1), RIGHT('abc', -2), RIGHT('abc', -3), R
 ----
 (empty)	(empty)	(empty)	(empty)	(empty)
 
+# test RIGHT on NULL values
+query TTT
+SELECT RIGHT(NULL, 0), RIGHT('abc', NULL), RIGHT(NULL, NULL)
+----
+NULL	NULL	NULL
+
+query TTT
+SELECT RIGHT(NULL, 0), RIGHT('🦆ab', NULL), RIGHT(NULL, NULL)
+----
+NULL	NULL	NULL
+
 # test on tables
 statement ok
 DROP TABLE IF EXISTS strings
diff --git a/modules/calcite/src/test/sql/function/string/test_right.test_ignore b/modules/calcite/src/test/sql/function/string/test_right.test_ignore
index 5ce06b5..1e92b36 100644
--- a/modules/calcite/src/test/sql/function/string/test_right.test_ignore
+++ b/modules/calcite/src/test/sql/function/string/test_right.test_ignore
@@ -2,7 +2,6 @@
 # description: RIGHT test
 # group: [string]
 # Ignored: https://issues.apache.org/jira/browse/IGNITE-14677
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
 
 # test RIGHT on positive positions
 query TTTTT
diff --git a/modules/calcite/src/test/sql/function/string/test_substring.test b/modules/calcite/src/test/sql/function/string/test_substring.test
index de23c77..ebb7c1b 100644
--- a/modules/calcite/src/test/sql/function/string/test_substring.test
+++ b/modules/calcite/src/test/sql/function/string/test_substring.test
@@ -66,6 +66,63 @@ ell
 h
 el
 
+# test substrings with constant nulls in different places
+query T
+SELECT substring(NULL from off for length) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring('hello' from NULL::int for length) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring('hello' from off for NULL::int) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring(NULL from NULL::int for length) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring('hello' from NULL::int for NULL::int) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring(NULL from off for NULL::int) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
+query T
+SELECT substring(NULL from NULL::int for NULL::int) FROM strings
+----
+NULL
+NULL
+NULL
+NULL
+
 # Negative from
 query T
 SELECT substring(s from -2 for 2) FROM strings ORDER BY id
diff --git a/modules/calcite/src/test/sql/function/string/test_substring.test_ignore b/modules/calcite/src/test/sql/function/string/test_substring.test_ignore
deleted file mode 100644
index 879a25a..0000000
--- a/modules/calcite/src/test/sql/function/string/test_substring.test_ignore
+++ /dev/null
@@ -1,192 +0,0 @@
-# name: test/sql/function/string/test_substring.test
-# description: Substring test
-# group: [string]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-15002
-
-statement ok
-CREATE TABLE strings(id INTEGER, s VARCHAR, off INTEGER, length INTEGER);
-
-statement ok
-INSERT INTO strings VALUES (0, 'hello', 1, 2), (1, 'world', 2, 3), (2, 'b', 1, 1), (3, NULL, 2, 2)
-
-# test zero length
-query TT
-SELECT SUBSTRING('🦆ab', 1, 0), SUBSTRING('abc', 1, 0)
-----
-(empty)	(empty)
-
-# constant offset/length
-# normal substring
-query T
-SELECT substring(s from 1 for 2) FROM strings ORDER BY id
-----
-he
-wo
-b
-NULL
-
-# substring out of range
-query T
-SELECT substring(s from 2 for 2) FROM strings ORDER BY id
-----
-el
-or
-(empty)
-NULL
-
-# variable length offset/length
-query T
-SELECT substring(s from off for length) FROM strings ORDER BY id
-----
-he
-orl
-b
-NULL
-
-query T
-SELECT substring(s from off for 2) FROM strings ORDER BY id
-----
-he
-or
-b
-NULL
-
-query T
-SELECT substring(s from 1 for length) FROM strings ORDER BY id
-----
-he
-wor
-b
-NULL
-
-query T
-SELECT substring('hello' from off for length) FROM strings ORDER BY id
-----
-he
-ell
-h
-el
-
-# test substrings with constant nulls in different places
-query T
-SELECT substring(NULL from off for length) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring('hello' from NULL for length) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring('hello' from off for NULL) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring(NULL from NULL for length) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring('hello' from NULL for NULL) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring(NULL from off for NULL) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-query T
-SELECT substring(NULL from NULL for NULL) FROM strings
-----
-NULL
-NULL
-NULL
-NULL
-
-# Negative from
-query T
-SELECT substring(s from -2 for 2) FROM strings ORDER BY id
-----
-(empty)
-(empty)
-(empty)
-NULL
-
-# zero offset (this is accepted by SQLite)
-query T
-SELECT substring(s from 0 for length) FROM strings ORDER BY id
-----
-h
-wo
-(empty)
-NULL
-
-# Negative length
-statement error
-SELECT substring(s, 2, -2) FROM strings ORDER BY id
-
-# negative offset and negative length
-statement error
-SELECT substring(s, -2, -2) FROM strings ORDER BY id
-
-# length 0
-query T
-SELECT substring(s, 2, 0) FROM strings ORDER BY id
-----
-(empty)
-(empty)
-(empty)
-NULL
-
-# no length
-query T
-SELECT substring(s, 2) FROM strings ORDER BY id
-----
-ello
-orld
-(empty)
-NULL
-
-# very large offset and length
-query T
-SELECT substring(s, 2147483647, 2147483647) FROM strings ORDER BY id
-----
-(empty)
-(empty)
-(empty)
-NULL
-
-statement error
-SELECT substring(s, 2147483647, -2147483647) FROM strings ORDER BY id
-
-query T
-SELECT substring(s, -2147483647, 2147483647) FROM strings ORDER BY id
-----
-(empty)
-(empty)
-(empty)
-NULL
-
-statement error
-SELECT substring(s, -2147483647, -2147483647) FROM strings ORDER BY id