This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 1641f1b27c6 [fix] (vectorization) regexp all_pass string (#32515)
(#33142)
1641f1b27c6 is described below
commit 1641f1b27c65398acf2d74eec4bedffaea9b34a5
Author: Kang <[email protected]>
AuthorDate: Tue Apr 2 22:09:00 2024 +0800
[fix] (vectorization) regexp all_pass string (#32515) (#33142)
Co-authored-by: Qifeng <[email protected]>
---
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 2d45bab32b5..ef89ed694c2 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: [email protected]
For additional commands, e-mail: [email protected]