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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new eac772cef1a [Bug](agg-state) fix file load insert wrong data to 
agg_state (#26581) (#26765)
eac772cef1a is described below

commit eac772cef1a1c25d76890ff7a86b08a4b8d20494
Author: Pxl <[email protected]>
AuthorDate: Fri Nov 10 22:07:47 2023 +0800

    [Bug](agg-state) fix file load insert wrong data to agg_state (#26581) 
(#26765)
---
 .../java/org/apache/doris/planner/ScanNode.java    |  3 +-
 regression-test/data/mv_p0/dis_26495/dis_26495.out |  9 +++++
 regression-test/data/mv_p0/dis_26495/test.csv      |  3 ++
 .../suites/mv_p0/dis_26495/dis_26495.groovy        | 42 ++++++++++++++++++++++
 4 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
index b5b365886e5..8d0cb1152df 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/ScanNode.java
@@ -126,7 +126,8 @@ public abstract class ScanNode extends PlanNode {
         if (PrimitiveType.typeWithPrecision.contains(dstType) && 
PrimitiveType.typeWithPrecision.contains(srcType)
                 && !slotDesc.getType().equals(expr.getType())) {
             return expr.castTo(slotDesc.getType());
-        } else if (dstType != srcType) {
+        } else if (dstType != srcType || slotDesc.getType().isAggStateType() 
&& expr.getType().isAggStateType()
+                && !slotDesc.getType().equals(expr.getType())) {
             return expr.castTo(slotDesc.getType());
         } else {
             return expr;
diff --git a/regression-test/data/mv_p0/dis_26495/dis_26495.out 
b/regression-test/data/mv_p0/dis_26495/dis_26495.out
new file mode 100644
index 00000000000..51bc5cf2e0b
--- /dev/null
+++ b/regression-test/data/mv_p0/dis_26495/dis_26495.out
@@ -0,0 +1,9 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !select --
+1
+
+-- !select --
+1      2       1
+1      3       1
+2      2       2
+
diff --git a/regression-test/data/mv_p0/dis_26495/test.csv 
b/regression-test/data/mv_p0/dis_26495/test.csv
new file mode 100644
index 00000000000..0f6ba30ad8a
--- /dev/null
+++ b/regression-test/data/mv_p0/dis_26495/test.csv
@@ -0,0 +1,3 @@
+1,2
+2,2
+1,3
diff --git a/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy 
b/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy
new file mode 100644
index 00000000000..4cc3842b991
--- /dev/null
+++ b/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy
@@ -0,0 +1,42 @@
+// 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.
+
+import org.codehaus.groovy.runtime.IOGroovyMethods
+
+suite ("dis_26495") {
+    sql "set enable_agg_state=true"
+    sql """ DROP TABLE IF EXISTS doris_test; """
+
+    sql """
+        create table doris_test (a int,b int, agg_st_1 agg_state max_by(int 
,int))
+            DISTRIBUTED BY HASH(a) BUCKETS 1 properties("replication_num" = 
"1");
+        """
+
+    sql """insert into doris_test values (1,2,max_by_state(1,2));"""
+
+    streamLoad {
+        table "doris_test"
+        set 'column_separator', ','
+        set 'columns', 'a, b, agg_st_1=max_by_state(a,b)'
+
+        file './test.csv'
+        time 10000 // limit inflight 10s
+    }
+
+    qt_select """select max_by_merge(agg_st_1) from doris_test"""
+    qt_select """select a,b,max_by_merge(agg_st_1) from doris_test group by 
a,b order by a,b"""
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to