[fix](join) fix decimal overflow caused by left outer join (#28221)
For left outer join or full outer join, when build side data is empty, null data is output for build side, but nested column data of nullable column is not properly initialized, which may cause decimal arithmetic overflow
This commit is contained in:
@ -367,7 +367,7 @@ Status HashJoinNode::pull(doris::RuntimeState* state, vectorized::Block* output_
|
||||
(_join_op != TJoinOp::LEFT_ANTI_JOIN) && i < _right_output_slot_flags.size(); ++i) {
|
||||
auto type = remove_nullable(_right_table_data_types[i]);
|
||||
auto column = type->create_column();
|
||||
column->resize(block_rows);
|
||||
column->insert_many_defaults(block_rows);
|
||||
auto null_map_column = ColumnVector<UInt8>::create(block_rows, 1);
|
||||
auto nullable_column =
|
||||
ColumnNullable::create(std::move(column), std::move(null_map_column));
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
-- This file is automatically generated. You should know what you did if you want to edit this
|
||||
-- !sql --
|
||||
1.1 \N \N
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
// 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("fix-overflow") {
|
||||
sql "set check_overflow_for_decimal=true;"
|
||||
sql "drop table if exists fix_overflow_l;"
|
||||
sql """
|
||||
create table fix_overflow_l(k1 decimalv3(38,1)) distributed by hash(k1) properties("replication_num"="1");
|
||||
"""
|
||||
sql "drop table if exists fix_overflow_r;"
|
||||
sql """
|
||||
create table fix_overflow_r(k1 decimalv3(38,1)) distributed by hash(k1) properties("replication_num"="1");
|
||||
"""
|
||||
sql """
|
||||
insert into fix_overflow_l values(1.1);
|
||||
"""
|
||||
qt_sql """
|
||||
select l.k1, r.k1, l.k1 * r.k1 from fix_overflow_l l left join fix_overflow_r r on l.k1=r.k1;
|
||||
"""
|
||||
}
|
||||
@ -17,6 +17,7 @@
|
||||
|
||||
suite("test_arithmetic_expressions") {
|
||||
|
||||
sql "set check_overflow_for_decimal=true;"
|
||||
sql "set enable_decimal256 = false;"
|
||||
|
||||
sql "drop table if exists test_arithmetic_expressions"
|
||||
|
||||
Reference in New Issue
Block a user