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

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b94cd1060d [fix] (vectorization) regexp all_pass string (#32515)
2b94cd1060d is described below

commit 2b94cd1060d1fb6d9997fa867e11e6a4aec4d257
Author: Qifeng <69379048+acking-...@users.noreply.github.com>
AuthorDate: Sat Mar 30 19:36:24 2024 +0800

    [fix] (vectorization) regexp all_pass string (#32515)
---
 be/src/vec/functions/like.cpp                      |  2 +-
 .../test_function_regexp_passall.out               | 37 +++++++++++++++
 .../test_function_regexp_passall.groovy            | 52 ++++++++++++++++++++++
 3 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/functions/like.cpp b/be/src/vec/functions/like.cpp
index cacf97f954e..376e28c0690 100644
--- a/be/src/vec/functions/like.cpp
+++ b/be/src/vec/functions/like.cpp
@@ -51,7 +51,7 @@ static const RE2 
STARTS_WITH_RE(R"(\^([^\.\^\{\[\(\|\)\]\}\+\*\?\$\\]*)(?:\.\*)*
 // A regex to match any regex pattern which is equivalent to a constant string 
match.
 static const RE2 EQUALS_RE(R"(\^([^\.\^\{\[\(\|\)\]\}\+\*\?\$\\]*)\$)");
 // A regex to match .*
-static const RE2 ALLPASS_RE(R"((\\.\*)+)");
+static const RE2 ALLPASS_RE(R"((\.\*)+)");
 
 // Like patterns
 static const re2::RE2 LIKE_SUBSTRING_RE(R"((?:%+)(((\\_)|([^%_\\]))+)(?:%+))");
diff --git 
a/regression-test/data/nereids_syntax_p0/test_function_regexp_passall.out 
b/regression-test/data/nereids_syntax_p0/test_function_regexp_passall.out
new file mode 100644
index 00000000000..e2d0cfb3a63
--- /dev/null
+++ b/regression-test/data/nereids_syntax_p0/test_function_regexp_passall.out
@@ -0,0 +1,37 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !sql --
+0      prefix0_infix0_suffix0  prefix0
+1      %prefix1_infix1_suffix1 prefix1
+2      prefix2_$infix2$suffix2 infix2
+3      prefix3^infix3_suffix3  infix3
+4      $$$prefix4_$$$infix4%%%^^suffix4        suffix4
+5      prefix5%%$$$__infix5$^^^%%$$suffix5     suffix5
+6      prefix6__^^%%%infix6%^suffix6%  prefix6_^^%%%infix6%^suffix6%
+7      %%%^^^$$$prefix7_infix7_suffix7%%%^^^$$$        prefix7_infix7_suffix7
+8      prefix8^^%%%infix8%%$$^^___suffix8      
+9      prefix9$$%%%^^infix9&&%%$$suffix9       \N
+
+-- !sql --
+0      prefix0_infix0_suffix0  prefix0
+1      %prefix1_infix1_suffix1 prefix1
+2      prefix2_$infix2$suffix2 infix2
+3      prefix3^infix3_suffix3  infix3
+4      $$$prefix4_$$$infix4%%%^^suffix4        suffix4
+5      prefix5%%$$$__infix5$^^^%%$$suffix5     suffix5
+6      prefix6__^^%%%infix6%^suffix6%  prefix6_^^%%%infix6%^suffix6%
+7      %%%^^^$$$prefix7_infix7_suffix7%%%^^^$$$        prefix7_infix7_suffix7
+8      prefix8^^%%%infix8%%$$^^___suffix8      
+9      prefix9$$%%%^^infix9&&%%$$suffix9       \N
+
+-- !sql --
+0      prefix0_infix0_suffix0  prefix0
+1      %prefix1_infix1_suffix1 prefix1
+2      prefix2_$infix2$suffix2 infix2
+3      prefix3^infix3_suffix3  infix3
+4      $$$prefix4_$$$infix4%%%^^suffix4        suffix4
+5      prefix5%%$$$__infix5$^^^%%$$suffix5     suffix5
+6      prefix6__^^%%%infix6%^suffix6%  prefix6_^^%%%infix6%^suffix6%
+7      %%%^^^$$$prefix7_infix7_suffix7%%%^^^$$$        prefix7_infix7_suffix7
+8      prefix8^^%%%infix8%%$$^^___suffix8      
+9      prefix9$$%%%^^infix9&&%%$$suffix9       \N
+
diff --git 
a/regression-test/suites/nereids_syntax_p0/test_function_regexp_passall.groovy 
b/regression-test/suites/nereids_syntax_p0/test_function_regexp_passall.groovy
new file mode 100644
index 00000000000..355b9e5b714
--- /dev/null
+++ 
b/regression-test/suites/nereids_syntax_p0/test_function_regexp_passall.groovy
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_function_regexp_passall") {
+    sql """
+        CREATE TABLE test_function_regexp_passall (
+            id int,
+            value_col string,
+            pattern_col string
+        ) 
+        ENGINE=OLAP
+        DISTRIBUTED BY HASH(id) BUCKETS 4
+        PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1"
+        );
+    """
+
+    sql """INSERT INTO test_function_regexp_passall VALUES
+            (0, 'prefix0_infix0_suffix0', 'prefix0'),
+            (1, '%prefix1_infix1_suffix1', 'prefix1'),
+            (2, 'prefix2_\$infix2\$suffix2', 'infix2'),
+            (3, 'prefix3^infix3_suffix3', 'infix3'),
+            (4, '\$\$\$prefix4_\$\$\$infix4%%%^^suffix4', 'suffix4'),
+            (5, 'prefix5%%\$\$\$__infix5\$^^^%%\$\$suffix5', 'suffix5'),
+            (6, 'prefix6__^^%%%infix6%^suffix6%', 
'prefix6_^^%%%infix6%^suffix6%'),
+            (7, '%%%^^^\$\$\$prefix7_infix7_suffix7%%%^^^\$\$\$', 
'prefix7_infix7_suffix7'),
+            (8, 'prefix8^^%%%infix8%%\$\$^^___suffix8', ''),
+            (9, 'prefix9\$\$%%%^^infix9&&%%\$\$suffix9', NULL);
+    """
+
+    qt_sql "SELECT * FROM test_function_regexp_passall WHERE value_col REGEXP 
'.*' ORDER BY id;"
+
+    qt_sql "SELECT * FROM test_function_regexp_passall WHERE value_col REGEXP 
'.' ORDER BY id;"
+
+    qt_sql "SELECT * FROM test_function_regexp_passall WHERE value_col REGEXP 
'.*.*' ORDER BY id;"
+
+    sql """DROP TABLE IF EXISTS test_function_regexp_passall FORCE; """
+}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to