[fix](function) fix error return type in corr(float32,float32) (#39251) (#39350)

https://github.com/apache/doris/pull/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=

```

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->
This commit is contained in:
Mryange
2024-08-14 18:47:14 +08:00
committed by GitHub
parent a9692a305e
commit b26af32934
3 changed files with 6 additions and 3 deletions

View File

@ -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>;
};

View File

@ -11,3 +11,6 @@
-- !sql --
0.8944271909999159
-- !sql --
0.8944271909999159

View File

@ -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 """
}