From b212613113ce8a4bc045e5d0a0bb94177dc220ce Mon Sep 17 00:00:00 2001
From: Arseniy Volynets <a.volynets@picodata.io>
Date: Tue, 24 Sep 2024 10:17:00 +0300
Subject: [PATCH] feat(sql): support ilike operator

---
 CHANGELOG.md         |  2 ++
 sbroad               |  2 +-
 test/int/test_sql.py | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 302dea52b5..df9fa5774c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -44,7 +44,9 @@ with the `YY.MINOR.MICRO` scheme.
 [.proc_wait_index]: https://docs.picodata.io/picodata/devel/architecture/rpc_api/#proc_wait_index
 
 ### SQL
+
 - SQL supports `LIKE` operator
+- SQL supports `ILIKE` operator
 - SQL supports `lower` and `upper` string functions
 
 ## [24.5.1] - 2024-09-04
diff --git a/sbroad b/sbroad
index 93dc653dc5..cf127608d6 160000
--- a/sbroad
+++ b/sbroad
@@ -1 +1 @@
-Subproject commit 93dc653dc57a58702c4e8e8af9a52d3fd4fd58e6
+Subproject commit cf127608d6030c50da9e0c5e1a3168607e678896
diff --git a/test/int/test_sql.py b/test/int/test_sql.py
index f26457fd0a..18773df20a 100644
--- a/test/int/test_sql.py
+++ b/test/int/test_sql.py
@@ -5240,6 +5240,7 @@ def test_like(instance: Instance):
     )
 
     instance.sql(""" insert into t values (1, 'abacaba'), (2, 'AbaC'), (3, '%__%')""")
+    # test LIKE operator
 
     data = instance.sql(r" select '_' like '\_' and '%' like '\%' from (values (1))")
     assert data == [[True]]
@@ -5301,3 +5302,21 @@ def test_like(instance: Instance):
         match="ESCAPE expression must be a single character",
     ):
         instance.sql(r"""select s like '%' escape 'a' || 'a' from t""")
+
+    # test ILIKE operator
+    data = instance.sql("select 'AbA' ilike 'aba' from (values (1))")
+    assert data[0] == [True]
+
+    data = instance.sql("select 'aba' ilike 'aBa' from (values (1))")
+    assert data[0] == [True]
+
+    data = instance.sql("select 'ABA' ilike '%b%' from (values (1))")
+    assert data[0] == [True]
+
+    data = instance.sql("select 'ABA' ilike '_b%' from (values (1))")
+    assert data[0] == [True]
+
+    data = instance.sql(
+        r"""select '%UU_' ilike '\%uu\_' escape '\' from (values (1))"""
+    )
+    assert data[0] == [True]
-- 
GitLab