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

commit c341963deecb65edeaac0e167ad95d595966dcef
Author: morrySnow <[email protected]>
AuthorDate: Mon Oct 9 15:55:57 2023 +0800

    [opt](Nereids) support like and regexp function (#25148)
---
 .../doris/catalog/BuiltinScalarFunctions.java      |  4 +++
 .../data/nereids_function_p0/scalar_function/L.out | 37 +++++++++++++++++++---
 .../data/nereids_function_p0/scalar_function/R.out | 29 +++++++++++++++++
 .../nereids_function_p0/scalar_function/L.groovy   |  2 ++
 .../nereids_function_p0/scalar_function/R.groovy   |  2 ++
 5 files changed, 70 insertions(+), 4 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
index b2b6170f435..fb2231644ac 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinScalarFunctions.java
@@ -17,6 +17,8 @@
 
 package org.apache.doris.catalog;
 
+import org.apache.doris.nereids.trees.expressions.Like;
+import org.apache.doris.nereids.trees.expressions.Regexp;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Abs;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.Acos;
 import org.apache.doris.nereids.trees.expressions.functions.scalar.AesDecrypt;
@@ -558,6 +560,7 @@ public class BuiltinScalarFunctions implements 
FunctionHelper {
             scalar(Least.class, "least"),
             scalar(Left.class, "left"),
             scalar(Length.class, "length"),
+            scalar(Like.class, "like"),
             scalar(Ln.class, "ln"),
             scalar(Locate.class, "locate"),
             scalar(Log.class, "log"),
@@ -614,6 +617,7 @@ public class BuiltinScalarFunctions implements 
FunctionHelper {
             scalar(Quarter.class, "quarter"),
             scalar(Radians.class, "radians"),
             scalar(Random.class, "rand", "random"),
+            scalar(Regexp.class, "regexp"),
             scalar(RegexpExtract.class, "regexp_extract"),
             scalar(RegexpExtractAll.class, "regexp_extract_all"),
             scalar(RegexpReplace.class, "regexp_replace"),
diff --git a/regression-test/data/nereids_function_p0/scalar_function/L.out 
b/regression-test/data/nereids_function_p0/scalar_function/L.out
index 3a9ea2a1687..195173d8f5a 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/L.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/L.out
@@ -637,6 +637,35 @@ string3
 7
 7
 
+-- !sql_like_Varchar_Varchar --
+true
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
+-- !sql_like_Varchar_Varchar_not_null --
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
 -- !sql_ln_Double --
 \N
 -2.3025850929940455
@@ -818,12 +847,12 @@ string3
 -0.5228787452803376
 -0.3979400086720376
 -0.3010299956639812
--0.22184874961635637
+-0.2218487496163564
 -0.1549019599857432
 -0.09691001300805639
 -0.045757490560675115
 0.0
-0.04139268515822507
+0.04139268515822508
 0.07918124604762482
 
 -- !sql_log10_Double_notnull --
@@ -832,12 +861,12 @@ string3
 -0.5228787452803376
 -0.3979400086720376
 -0.3010299956639812
--0.22184874961635637
+-0.2218487496163564
 -0.1549019599857432
 -0.09691001300805639
 -0.045757490560675115
 0.0
-0.04139268515822507
+0.04139268515822508
 0.07918124604762482
 
 -- !sql_log2_Double --
diff --git a/regression-test/data/nereids_function_p0/scalar_function/R.out 
b/regression-test/data/nereids_function_p0/scalar_function/R.out
index 3145c2c6dc0..44c73657f5c 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/R.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/R.out
@@ -28,6 +28,35 @@
 0.019198621771937627
 0.020943951023931952
 
+-- !sql_regexp_Varchar_Varchar --
+true
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
+-- !sql_regexp_Varchar_Varchar_not_null --
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+false
+
 -- !sql_regexp_extract_Varchar_Varchar_BigInt --
 \N
 
diff --git 
a/regression-test/suites/nereids_function_p0/scalar_function/L.groovy 
b/regression-test/suites/nereids_function_p0/scalar_function/L.groovy
index 02de3a95919..41df5c511a9 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/L.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/L.groovy
@@ -63,6 +63,8 @@ suite("nereids_scalar_fn_L") {
        qt_sql_length_Varchar_notnull "select length(kvchrs1) from 
fn_test_not_nullable order by kvchrs1"
        qt_sql_length_String "select length(kstr) from fn_test order by kstr"
        qt_sql_length_String_notnull "select length(kstr) from 
fn_test_not_nullable order by kstr"
+       qt_sql_like_Varchar_Varchar "select like(kvchrs1, kvchrs2) from fn_test 
order by kvchrs1"
+       qt_sql_like_Varchar_Varchar_not_null "select like(kvchrs1, kvchrs2) 
from fn_test_not_nullable order by kvchrs1"
        qt_sql_ln_Double "select ln(kdbl) from fn_test order by kdbl"
        qt_sql_ln_Double_notnull "select ln(kdbl) from fn_test_not_nullable 
order by kdbl"
        qt_sql_locate_Varchar_Varchar "select locate(kvchrs1, kvchrs1) from 
fn_test order by kvchrs1, kvchrs1"
diff --git 
a/regression-test/suites/nereids_function_p0/scalar_function/R.groovy 
b/regression-test/suites/nereids_function_p0/scalar_function/R.groovy
index 9c5c8dce9ba..b50cbc31e52 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/R.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/R.groovy
@@ -25,6 +25,8 @@ suite("nereids_scalar_fn_R") {
        sql "select random() from fn_test_not_nullable"
        sql "select random(1000) from fn_test order by kbint"
        sql "select random(1000) from fn_test_not_nullable order by kbint"
+       qt_sql_regexp_Varchar_Varchar "select regexp(kvchrs1, kvchrs2) from 
fn_test order by kvchrs1"
+       qt_sql_regexp_Varchar_Varchar_not_null "select regexp(kvchrs1, kvchrs2) 
from fn_test_not_nullable order by kvchrs1"
        qt_sql_regexp_extract_Varchar_Varchar_BigInt "select 
regexp_extract(kvchrs1, kvchrs1, kbint) from fn_test order by kvchrs1, kvchrs1, 
kbint"
        qt_sql_regexp_extract_Varchar_Varchar_BigInt_notnull "select 
regexp_extract(kvchrs1, kvchrs1, kbint) from fn_test_not_nullable order by 
kvchrs1, kvchrs1, kbint"
        qt_sql_regexp_extract_String_String_BigInt "select regexp_extract(kstr, 
kstr, kbint) from fn_test order by kstr, kstr, kbint"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to