Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug](agg-state) fix file load insert wrong data to agg_state (#26581) #26765

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[Bug](agg-state) fix file load insert wrong data to agg_state (#26581)
fix file load insert wrong data to agg_state
  • Loading branch information
BiteTheDDDDt committed Nov 10, 2023
commit 2002248c6e1beece9e88fb16bac28cbf67b3babc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ protected Expr castToSlot(SlotDescriptor slotDesc, Expr expr) throws UserExcepti
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;
Expand Down
9 changes: 9 additions & 0 deletions regression-test/data/mv_p0/dis_26495/dis_26495.out
Original file line number Diff line number Diff line change
@@ -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

3 changes: 3 additions & 0 deletions regression-test/data/mv_p0/dis_26495/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1,2
2,2
1,3
42 changes: 42 additions & 0 deletions regression-test/suites/mv_p0/dis_26495/dis_26495.groovy
Original file line number Diff line number Diff line change
@@ -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"""
}