1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

MCOL-5328: PCRE based regexp regexp_substr regexp_instr regexp_replace [stable-23.10] (#3215)

* MCOL-5328: PCRE based regexp regexp_substr regexp_instr regexp_replace

* Add qa test for MCOL-5328

---------

Co-authored-by: Susil Behera <susil.behera@mariadb.com>
This commit is contained in:
Leonid Fedorov
2024-06-27 14:20:08 +04:00
committed by GitHub
parent 2cd8f716c1
commit 6c6fa7d5a4
20 changed files with 6159 additions and 66 deletions

View File

@ -0,0 +1,27 @@
DROP DATABASE IF EXISTS mcol5328;
CREATE DATABASE mcol5328;
USE mcol5328;
CREATE TABLE cst1(a INT NOT NULL, b VARCHAR(100)) ENGINE=columnstore;
INSERT INTO cst1 VALUES(1, 'My mouse'),(2,'Breakfast Food');
SELECT a, b FROM cst1 WHERE b REGEXP '^My';
a b
1 My mouse
SELECT a, b FROM cst1 WHERE b REGEXP '[a|e|i|o|u]$';
a b
1 My mouse
SELECT a, b FROM cst1 WHERE b REGEXP '^Br[aeiou]{2}.*[aeiou]{2}d$';
a b
2 Breakfast Food
SELECT a, REGEXP_SUBSTR(b, 'a|e|i|o|u') AS "vowel" FROM cst1;
a vowel
1 o
2 e
select a, REGEXP_INSTR(b, 'a|e|i|o|u') AS "vowel" FROM cst1;
a vowel
1 5
2 3
select a, REGEXP_REPLACE(b, 'a|e|i|o|u', 'x') AS "vowel" FROM cst1;
a vowel
1 My mxxsx
2 Brxxkfxst Fxxd
DROP DATABASE mcol5328;

View File

@ -0,0 +1,20 @@
--source ../include/have_columnstore.inc
--disable_warnings
DROP DATABASE IF EXISTS mcol5328;
--enable_warnings
CREATE DATABASE mcol5328;
USE mcol5328;
CREATE TABLE cst1(a INT NOT NULL, b VARCHAR(100)) ENGINE=columnstore;
INSERT INTO cst1 VALUES(1, 'My mouse'),(2,'Breakfast Food');
SELECT a, b FROM cst1 WHERE b REGEXP '^My';
SELECT a, b FROM cst1 WHERE b REGEXP '[a|e|i|o|u]$';
SELECT a, b FROM cst1 WHERE b REGEXP '^Br[aeiou]{2}.*[aeiou]{2}d$';
SELECT a, REGEXP_SUBSTR(b, 'a|e|i|o|u') AS "vowel" FROM cst1;
select a, REGEXP_INSTR(b, 'a|e|i|o|u') AS "vowel" FROM cst1;
select a, REGEXP_REPLACE(b, 'a|e|i|o|u', 'x') AS "vowel" FROM cst1;
--disable_warnings
DROP DATABASE mcol5328;
--enable_warnings