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

lihaopeng 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 b949929276c [fix](function) fix error return type in 
corr(float32,float32)  (#39251)
b949929276c is described below

commit b949929276c199e0667e88ed617cbe85da5791b4
Author: Mryange <59914473+mrya...@users.noreply.github.com>
AuthorDate: Wed Aug 14 11:53:34 2024 +0800

    [fix](function) fix error return type in corr(float32,float32)  (#39251)
    
    ```
    mysql [test11]>select corr(cast(x as float),cast(y as float)) from 
test_corr;
    ERROR 1105 (HY000): errCode = 2, detailMessage = 
(127.0.0.1)[INTERNAL_ERROR]column_type not match data_types in agg node, 
column_type=Nullable(Float64), data_types=Nullable(Float32),column name=
    
    ```
---
 be/src/vec/aggregate_functions/aggregate_function_binary.h             | 3 +--
 regression-test/data/nereids_function_p0/agg_function/test_corr.out    | 3 +++
 .../suites/nereids_function_p0/agg_function/test_corr.groovy           | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/be/src/vec/aggregate_functions/aggregate_function_binary.h 
b/be/src/vec/aggregate_functions/aggregate_function_binary.h
index ca06cc1bb81..a5b6e2b1e0e 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_binary.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_binary.h
@@ -41,8 +41,7 @@ template <typename T1, typename T2, template <typename> 
typename Moments>
 struct StatFunc {
     using Type1 = T1;
     using Type2 = T2;
-    using ResultType = std::conditional_t<std::is_same_v<T1, T2> && 
std::is_same_v<T1, Float32>,
-                                          Float32, Float64>;
+    using ResultType = Float64;
     using Data = Moments<ResultType>;
 };
 
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 4fc9a9d4baa..c694f95ebec 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
@@ -11,3 +11,6 @@
 -- !sql --
 0.8944271909999159
 
+-- !sql --
+0.8944271909999159
+
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 15f27f84276..09ed98fab06 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
@@ -80,6 +80,7 @@ suite("test_corr") {
     (5, 5, 10)
     """
     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 """
 }


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

Reply via email to