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

morrysnow 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 05ed1f751b [fix](planner)(Nereids) add date and datev2 signature to 
greatest and least function (#16565)
05ed1f751b is described below

commit 05ed1f751bd75b39cafe28b4a5dd1a1b5b6cb959
Author: morrySnow <[email protected]>
AuthorDate: Thu Feb 9 21:36:53 2023 +0800

    [fix](planner)(Nereids) add date and datev2 signature to greatest and least 
function (#16565)
---
 .../expressions/functions/scalar/Greatest.java     |  4 +++
 .../trees/expressions/functions/scalar/Least.java  |  6 ++++
 gensrc/script/doris_builtins_functions.py          |  5 ++++
 .../nereids_function_p0/scalar_function/G-K.out    | 30 +++++++++++++++++++
 .../nereids_function_p0/scalar_function/L-Q.out    | 34 ++++++++++++++++++++--
 .../nereids_function_p0/scalar_function/G-K.groovy |  2 ++
 .../nereids_function_p0/scalar_function/L-Q.groovy |  2 ++
 7 files changed, 81 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java
index df88a9ed6a..46b62a9c57 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Greatest.java
@@ -25,6 +25,8 @@ import 
org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DateTimeType;
 import org.apache.doris.nereids.types.DateTimeV2Type;
+import org.apache.doris.nereids.types.DateType;
+import org.apache.doris.nereids.types.DateV2Type;
 import org.apache.doris.nereids.types.DecimalV2Type;
 import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.FloatType;
@@ -56,6 +58,8 @@ public class Greatest extends ScalarFunction
             
FunctionSignature.ret(FloatType.INSTANCE).varArgs(FloatType.INSTANCE),
             
FunctionSignature.ret(DoubleType.INSTANCE).varArgs(DoubleType.INSTANCE),
             
FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT).varArgs(DecimalV2Type.SYSTEM_DEFAULT),
+            
FunctionSignature.ret(DateType.INSTANCE).varArgs(DateType.INSTANCE),
+            
FunctionSignature.ret(DateV2Type.INSTANCE).varArgs(DateV2Type.INSTANCE),
             
FunctionSignature.ret(DateTimeType.INSTANCE).varArgs(DateTimeType.INSTANCE),
             
FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).varArgs(DateTimeV2Type.SYSTEM_DEFAULT),
             
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).varArgs(VarcharType.SYSTEM_DEFAULT),
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Least.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Least.java
index 883812d940..5276984b96 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Least.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Least.java
@@ -24,6 +24,9 @@ import 
org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DateTimeType;
+import org.apache.doris.nereids.types.DateTimeV2Type;
+import org.apache.doris.nereids.types.DateType;
+import org.apache.doris.nereids.types.DateV2Type;
 import org.apache.doris.nereids.types.DecimalV2Type;
 import org.apache.doris.nereids.types.DoubleType;
 import org.apache.doris.nereids.types.FloatType;
@@ -54,7 +57,10 @@ public class Least extends ScalarFunction
             
FunctionSignature.ret(LargeIntType.INSTANCE).varArgs(LargeIntType.INSTANCE),
             
FunctionSignature.ret(FloatType.INSTANCE).varArgs(FloatType.INSTANCE),
             
FunctionSignature.ret(DoubleType.INSTANCE).varArgs(DoubleType.INSTANCE),
+            
FunctionSignature.ret(DateType.INSTANCE).varArgs(DateType.INSTANCE),
+            
FunctionSignature.ret(DateV2Type.INSTANCE).varArgs(DateV2Type.INSTANCE),
             
FunctionSignature.ret(DateTimeType.INSTANCE).varArgs(DateTimeType.INSTANCE),
+            
FunctionSignature.ret(DateTimeV2Type.SYSTEM_DEFAULT).varArgs(DateTimeV2Type.SYSTEM_DEFAULT),
             
FunctionSignature.ret(DecimalV2Type.SYSTEM_DEFAULT).varArgs(DecimalV2Type.SYSTEM_DEFAULT),
             
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).varArgs(VarcharType.SYSTEM_DEFAULT),
             
FunctionSignature.ret(StringType.INSTANCE).varArgs(StringType.INSTANCE)
diff --git a/gensrc/script/doris_builtins_functions.py 
b/gensrc/script/doris_builtins_functions.py
index fd6a47529e..95cb88bb6f 100644
--- a/gensrc/script/doris_builtins_functions.py
+++ b/gensrc/script/doris_builtins_functions.py
@@ -1056,7 +1056,10 @@ visible_functions = [
     [['least'], 'LARGEINT', ['LARGEINT', '...'], ''],
     [['least'], 'FLOAT', ['FLOAT', '...'], ''],
     [['least'], 'DOUBLE', ['DOUBLE', '...'], ''],
+    [['least'], 'DATE', ['DATE', '...'], ''],
+    [['least'], 'DATEV2', ['DATEV2', '...'], ''],
     [['least'], 'DATETIME', ['DATETIME', '...'], ''],
+    [['least'], 'DATETIMEV2', ['DATETIMEV2', '...'], ''],
     [['least'], 'DECIMALV2', ['DECIMALV2', '...'], ''],
     [['least'], 'DECIMAL32', ['DECIMAL32', '...'], ''],
     [['least'], 'DECIMAL64', ['DECIMAL64', '...'], ''],
@@ -1075,6 +1078,8 @@ visible_functions = [
     [['greatest'], 'DECIMAL32', ['DECIMAL32', '...'], ''],
     [['greatest'], 'DECIMAL64', ['DECIMAL64', '...'], ''],
     [['greatest'], 'DECIMAL128', ['DECIMAL128', '...'], ''],
+    [['greatest'], 'DATE', ['DATE', '...'], ''],
+    [['greatest'], 'DATEV2', ['DATEV2', '...'], ''],
     [['greatest'], 'DATETIME', ['DATETIME', '...'], ''],
     [['greatest'], 'DATETIMEV2', ['DATETIMEV2', '...'], ''],
     [['greatest'], 'VARCHAR', ['VARCHAR', '...'], ''],
diff --git a/regression-test/data/nereids_function_p0/scalar_function/G-K.out 
b/regression-test/data/nereids_function_p0/scalar_function/G-K.out
index f0cb9efd8d..2d1010a301 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/G-K.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/G-K.out
@@ -209,6 +209,36 @@
 1.100000000
 1.200000000
 
+-- !sql --
+\N
+2012-03-01
+2012-03-02
+2012-03-03
+2012-03-04
+2012-03-05
+2012-03-06
+2012-03-07
+2012-03-08
+2012-03-09
+2012-03-10
+2012-03-11
+2012-03-12
+
+-- !sql --
+\N
+2012-03-01
+2012-03-02
+2012-03-03
+2012-03-04
+2012-03-05
+2012-03-06
+2012-03-07
+2012-03-08
+2012-03-09
+2012-03-10
+2012-03-11
+2012-03-12
+
 -- !sql --
 \N
 2012-03-01T01:00:01
diff --git a/regression-test/data/nereids_function_p0/scalar_function/L-Q.out 
b/regression-test/data/nereids_function_p0/scalar_function/L-Q.out
index 3c28424602..3a5036fdd0 100644
--- a/regression-test/data/nereids_function_p0/scalar_function/L-Q.out
+++ b/regression-test/data/nereids_function_p0/scalar_function/L-Q.out
@@ -164,6 +164,36 @@
 1.1
 1.2
 
+-- !sql --
+\N
+2012-03-01
+2012-03-02
+2012-03-03
+2012-03-04
+2012-03-05
+2012-03-06
+2012-03-07
+2012-03-08
+2012-03-09
+2012-03-10
+2012-03-11
+2012-03-12
+
+-- !sql --
+\N
+2012-03-01
+2012-03-02
+2012-03-03
+2012-03-04
+2012-03-05
+2012-03-06
+2012-03-07
+2012-03-08
+2012-03-09
+2012-03-10
+2012-03-11
+2012-03-12
+
 -- !sql --
 \N
 2012-03-01T01:00:01
@@ -381,12 +411,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 --
diff --git 
a/regression-test/suites/nereids_function_p0/scalar_function/G-K.groovy 
b/regression-test/suites/nereids_function_p0/scalar_function/G-K.groovy
index ab072953af..b51f4abbb1 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/G-K.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/G-K.groovy
@@ -34,6 +34,8 @@ suite("nereids_scalar_fn_2") {
     qt_sql "select greatest(kfloat) from fn_test order by kfloat"
     qt_sql "select greatest(kdbl) from fn_test order by kdbl"
     qt_sql "select greatest(kdcmls1) from fn_test order by kdcmls1"
+    qt_sql "select greatest(kdt) from fn_test order by kdt"
+    qt_sql "select greatest(kdtv2) from fn_test order by kdtv2"
     qt_sql "select greatest(kdtm) from fn_test order by kdtm"
     qt_sql "select greatest(kdtmv2s1) from fn_test order by kdtmv2s1"
     qt_sql "select greatest(kvchrs1) from fn_test order by kvchrs1"
diff --git 
a/regression-test/suites/nereids_function_p0/scalar_function/L-Q.groovy 
b/regression-test/suites/nereids_function_p0/scalar_function/L-Q.groovy
index 10b02e2aec..9d09b60571 100644
--- a/regression-test/suites/nereids_function_p0/scalar_function/L-Q.groovy
+++ b/regression-test/suites/nereids_function_p0/scalar_function/L-Q.groovy
@@ -31,6 +31,8 @@ suite("nereids_scalar_fn_3") {
     qt_sql "select least(klint) from fn_test order by klint"
     qt_sql "select least(kfloat) from fn_test order by kfloat"
     qt_sql "select least(kdbl) from fn_test order by kdbl"
+    qt_sql "select least(kdt) from fn_test order by kdt"
+    qt_sql "select least(kdtv2) from fn_test order by kdtv2"
     qt_sql "select least(kdtm) from fn_test order by kdtm"
     qt_sql "select least(kdcmls1) from fn_test order by kdcmls1"
     qt_sql "select least(kvchrs1) from fn_test order by kvchrs1"


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

Reply via email to