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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 4acd69590da [Fix](function) fix wrong nullable signature of function 
corr (#39380)
4acd69590da is described below

commit 4acd69590da5fa685cafaf78148a48573e064218
Author: zclllhhjj <zhaochan...@selectdb.com>
AuthorDate: Thu Aug 15 14:10:09 2024 +0800

    [Fix](function) fix wrong nullable signature of function corr (#39380)
    
    ## Proposed changes
    
    Issue Number: close #xxx
    
    before `corr(nullable_x, nullable_y)` will core dump. not fixed.
    no need to patch in master because the refactor
    https://github.com/apache/doris/pull/37330 already changed the
    implementation context
---
 .../trees/expressions/functions/agg/Corr.java       |  4 ++--
 .../nereids_function_p0/agg_function/test_corr.out  | 21 +++++++++++++++++++++
 .../agg_function/test_corr.groovy                   |  5 ++++-
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Corr.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Corr.java
index 26f8a720c26..b88b54d1378 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Corr.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg/Corr.java
@@ -19,8 +19,8 @@ package 
org.apache.doris.nereids.trees.expressions.functions.agg;
 
 import org.apache.doris.catalog.FunctionSignature;
 import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.functions.AlwaysNullable;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
+import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
 import org.apache.doris.nereids.trees.expressions.shape.UnaryExpression;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.BigIntType;
@@ -39,7 +39,7 @@ import java.util.List;
  * AggregateFunction 'corr'. This class is generated by GenerateFunction.
  */
 public class Corr extends AggregateFunction
-        implements UnaryExpression, ExplicitlyCastableSignature, 
AlwaysNullable {
+        implements UnaryExpression, ExplicitlyCastableSignature, 
PropagateNullable {
 
     public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
             
FunctionSignature.ret(DoubleType.INSTANCE).args(TinyIntType.INSTANCE, 
TinyIntType.INSTANCE),
diff --git 
a/regression-test/data/nereids_function_p0/agg_function/test_corr.out 
b/regression-test/data/nereids_function_p0/agg_function/test_corr.out
index c694f95ebec..71293030ba8 100644
--- a/regression-test/data/nereids_function_p0/agg_function/test_corr.out
+++ b/regression-test/data/nereids_function_p0/agg_function/test_corr.out
@@ -14,3 +14,24 @@
 -- !sql --
 0.8944271909999159
 
+-- !sql1 --
+0.0
+0.0
+0.0
+0.0
+0.0
+
+-- !sql2 --
+0.0
+0.0
+0.0
+0.0
+0.0
+
+-- !sql3 --
+0.0
+0.0
+0.0
+0.0
+0.0
+
diff --git 
a/regression-test/suites/nereids_function_p0/agg_function/test_corr.groovy 
b/regression-test/suites/nereids_function_p0/agg_function/test_corr.groovy
index 09ed98fab06..c752e8cb133 100644
--- a/regression-test/suites/nereids_function_p0/agg_function/test_corr.groovy
+++ b/regression-test/suites/nereids_function_p0/agg_function/test_corr.groovy
@@ -82,5 +82,8 @@ suite("test_corr") {
     qt_sql "select corr(x,y) from test_corr"
 
     qt_sql "select corr(cast(x as float),cast(y as float)) from test_corr"
-    sql """ DROP TABLE IF EXISTS test_corr """
+    
+    qt_sql1 "select corr(non_nullable(x), non_nullable(y)) ans from test_corr 
group by id order by ans"
+    qt_sql2 "select corr(x, non_nullable(y)) ans from test_corr group by id 
order by ans"
+    qt_sql3 "select corr(non_nullable(x), y) ans from test_corr group by id 
order by ans"
 }


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

Reply via email to