From d02c9ec703ca1e8f7608c990eb5a7f53b71db104 Mon Sep 17 00:00:00 2001 From: Alexandr Romanenko Date: Wed, 6 Sep 2023 20:00:39 +0300 Subject: [PATCH 1/2] fix(cubestore): Escape regex symbols in like operator --- rust/cubestore/cubestore-sql-tests/src/tests.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rust/cubestore/cubestore-sql-tests/src/tests.rs b/rust/cubestore/cubestore-sql-tests/src/tests.rs index 684e6f1aaebad..5b88f76d9e09e 100644 --- a/rust/cubestore/cubestore-sql-tests/src/tests.rs +++ b/rust/cubestore/cubestore-sql-tests/src/tests.rs @@ -1579,7 +1579,14 @@ async fn ilike(service: Box) { .exec_query( "INSERT INTO s.strings(t, pat) \ VALUES ('aba', '%ABA'), ('ABa', '%aba%'), ('CABA', 'aba%'), ('ZABA', '%a%b%a%'), ('ZZZ', 'zzz'), ('TTT', 'TTT'),\ - ('some_underscore', '%some\\\\_underscore%')", + ('some_underscore', '%some\\\\_underscore%'),\ + ('test [ special 1', '%test [%'),\ + ('test ( special 2', '%test (%'),\ + ('111 test {)?*|+aaa', '%test {)?*|+aaa'),\ + ('test }]\\\\ 111 ', 'test }]\\\\ %'),\ + ('test2 }]\\\\222 ', 'test2 }]\\\\\\\\%')\ + ", + ) .await .unwrap(); @@ -1632,12 +1639,17 @@ async fn ilike(service: Box) { assert_eq!( to_rows(&r), rows(&[ + ("111 test {)?*|+aaa", "%test {)?*|+aaa"), ("ABa", "%aba%"), ("TTT", "TTT"), ("ZABA", "%a%b%a%"), ("ZZZ", "zzz"), ("aba", "%ABA"), ("some_underscore", "%some\\_underscore%"), + ("test ( special 2", "%test (%"), + ("test [ special 1", "%test [%"), + ("test }]\\ 111 ", "test }]\\ %"), + ("test2 }]\\222 ", "test2 }]\\\\%") ]) ); From cb9c7827812240aee66b937600822e73835f2ebe Mon Sep 17 00:00:00 2001 From: Alexandr Romanenko Date: Wed, 27 Sep 2023 15:19:38 +0300 Subject: [PATCH 2/2] update --- rust/cubestore/Cargo.lock | 8 ++++---- rust/cubestore/cubestore-sql-tests/src/tests.rs | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/rust/cubestore/Cargo.lock b/rust/cubestore/Cargo.lock index 1847650406bc9..a40bde31c6dd7 100644 --- a/rust/cubestore/Cargo.lock +++ b/rust/cubestore/Cargo.lock @@ -131,7 +131,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrow" version = "5.0.0" -source = "git+https://github.com/cube-js/arrow-rs?branch=cube#93c26ef581ba7fc7466902bc5eaa83bed5308c46" +source = "git+https://github.com/cube-js/arrow-rs?branch=cube#c296882197dea4d1c38732c1db63c0e505e55436" dependencies = [ "bitflags", "chrono", @@ -154,7 +154,7 @@ dependencies = [ [[package]] name = "arrow-flight" version = "5.0.0" -source = "git+https://github.com/cube-js/arrow-rs?branch=cube#93c26ef581ba7fc7466902bc5eaa83bed5308c46" +source = "git+https://github.com/cube-js/arrow-rs?branch=cube#c296882197dea4d1c38732c1db63c0e505e55436" dependencies = [ "arrow", "base64 0.13.0", @@ -3334,7 +3334,7 @@ dependencies = [ [[package]] name = "parquet" version = "5.0.0" -source = "git+https://github.com/cube-js/arrow-rs?branch=cube#93c26ef581ba7fc7466902bc5eaa83bed5308c46" +source = "git+https://github.com/cube-js/arrow-rs?branch=cube#c296882197dea4d1c38732c1db63c0e505e55436" dependencies = [ "arrow", "base64 0.13.0", @@ -5473,7 +5473,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 1.0.0", - "rand 0.8.4", + "rand 0.6.5", "static_assertions", ] diff --git a/rust/cubestore/cubestore-sql-tests/src/tests.rs b/rust/cubestore/cubestore-sql-tests/src/tests.rs index 5b88f76d9e09e..4332eb5796aeb 100644 --- a/rust/cubestore/cubestore-sql-tests/src/tests.rs +++ b/rust/cubestore/cubestore-sql-tests/src/tests.rs @@ -1583,7 +1583,6 @@ async fn ilike(service: Box) { ('test [ special 1', '%test [%'),\ ('test ( special 2', '%test (%'),\ ('111 test {)?*|+aaa', '%test {)?*|+aaa'),\ - ('test }]\\\\ 111 ', 'test }]\\\\ %'),\ ('test2 }]\\\\222 ', 'test2 }]\\\\\\\\%')\ ", @@ -1648,7 +1647,6 @@ async fn ilike(service: Box) { ("some_underscore", "%some\\_underscore%"), ("test ( special 2", "%test (%"), ("test [ special 1", "%test [%"), - ("test }]\\ 111 ", "test }]\\ %"), ("test2 }]\\222 ", "test2 }]\\\\%") ]) );