This is an automated email from the ASF dual-hosted git repository.
panxiaolei 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 a68c8df37fb [Bug](agg-state) fix agg state inner type not conversioned
(#50418)
a68c8df37fb is described below
commit a68c8df37fb0f3ce0806e96493fc8f715335c497
Author: Pxl <[email protected]>
AuthorDate: Wed Apr 30 18:19:41 2025 +0800
[Bug](agg-state) fix agg state inner type not conversioned (#50418)
### What problem does this PR solve?
drop table if exists t01;
create table t01(id int, decimal_col agg_state<sum(decimal(20,6))>
generic) properties ("replication_num" = "1");
insert into t01 values (1, sum_state(10.1)), (1, sum_state(20.1)), (2,
sum_state(10.2)), (2, sum_state(11.0));
select sum_merge(decimal_col) from t01 group by id;
[18:36]MySQL [email protected]:test_agg_state> select
sum_merge(decimal_col) from t01 group by id; (1105, "errCode = 2,
detailMessage =
(172.20.48.119)[INTERNAL_ERROR]AggState(function_name=sum,result_is_nullable=true,arguments=[Nullable(Decimal(27,
9))],be_exec_version=8)'s expect return type is Nullable(Decimal(27,
9)), but input Nullable(Decimal(76, 6))") [18:36]MySQL
[email protected]:test_agg_state>
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->
---
.../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]