This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 6bc495f5462 branch-3.0: [Bug](agg-state) fix agg state inner type not
conversioned #50418 (#50575)
6bc495f5462 is described below
commit 6bc495f546250812eadd15bb4009ec5065b013b2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed May 7 14:25:21 2025 +0800
branch-3.0: [Bug](agg-state) fix agg state inner type not conversioned
#50418 (#50575)
Cherry-picked from #50418
Co-authored-by: Pxl <[email protected]>
---
.../apache/doris/nereids/types/AggStateType.java | 6 ++++
.../agg_state/decimal_sum/test_decimal_sum.out | Bin 0 -> 130 bytes
.../agg_state/decimal_sum/test_decimal_sum.groovy | 31 +++++++++++++++++++++
3 files changed, 37 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java
index 2f704190fef..290a59acaa8 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/types/AggStateType.java
@@ -104,6 +104,12 @@ public class AggStateType extends DataType {
return Expr.createAggStateType(functionName, types, subTypeNullables);
}
+ @Override
+ public DataType conversion() {
+ return new AggStateType(functionName,
subTypes.stream().map(DataType::conversion).collect(Collectors.toList()),
+ subTypeNullables);
+ }
+
@Override
public boolean acceptsType(DataType other) {
return other instanceof AggStateType;
diff --git
a/regression-test/data/datatype_p0/agg_state/decimal_sum/test_decimal_sum.out
b/regression-test/data/datatype_p0/agg_state/decimal_sum/test_decimal_sum.out
new file mode 100644
index 00000000000..240ed8b30b8
Binary files /dev/null and
b/regression-test/data/datatype_p0/agg_state/decimal_sum/test_decimal_sum.out
differ
diff --git
a/regression-test/suites/datatype_p0/agg_state/decimal_sum/test_decimal_sum.groovy
b/regression-test/suites/datatype_p0/agg_state/decimal_sum/test_decimal_sum.groovy
new file mode 100644
index 00000000000..e8d643d26b9
--- /dev/null
+++
b/regression-test/suites/datatype_p0/agg_state/decimal_sum/test_decimal_sum.groovy
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_decimal_sum") {
+ sql "set enable_agg_state=true"
+ sql """ DROP TABLE IF EXISTS t01; """
+ sql """
+ create table t01(id int, decimal_col agg_state<sum(decimal(20,6))>
generic) properties ("replication_num" = "1");
+ """
+
+ sql """insert into t01 values (1, sum_state(10.1)), (1, sum_state(20.1)),
(2, sum_state(10.2)), (2, sum_state(11.0));
+"""
+
+
+ qt_select """ select sum_merge(decimal_col) from t01 group by id order by
id;
+ """
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]