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 2b365e5b2dc [fix](hash) fix incorrect result of hash with const column (#45670) 2b365e5b2dc is described below commit 2b365e5b2dc08e498ab41f383e86ae2a8cd3a738 Author: Xujian Duan <50550370+darvend...@users.noreply.github.com> AuthorDate: Tue Dec 24 20:27:48 2024 +0800 [fix](hash) fix incorrect result of hash with const column (#45670) Related PR: https://github.com/apache/doris/pull/45630 --- be/src/vec/runtime/partitioner.cpp | 6 +- .../data/query_p0/join/test_join_with_const.out | 8 +++ .../query_p0/join/test_join_with_const.groovy | 70 ++++++++++++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) diff --git a/be/src/vec/runtime/partitioner.cpp b/be/src/vec/runtime/partitioner.cpp index 671e77e9f1c..2654026ed91 100644 --- a/be/src/vec/runtime/partitioner.cpp +++ b/be/src/vec/runtime/partitioner.cpp @@ -41,7 +41,11 @@ Status Crc32HashPartitioner<ChannelIds>::do_partitioning(RuntimeState* state, Bl auto* __restrict hashes = _hash_vals.data(); { RETURN_IF_ERROR(_get_partition_column_result(block, result)); } for (int j = 0; j < result_size; ++j) { - _do_hash(unpack_if_const(block->get_by_position(result[j]).column).first, hashes, j); + const auto& [col, is_const] = unpack_if_const(block->get_by_position(result[j]).column); + if (is_const) { + continue; + } + _do_hash(col, hashes, j); } for (size_t i = 0; i < rows; i++) { diff --git a/regression-test/data/query_p0/join/test_join_with_const.out b/regression-test/data/query_p0/join/test_join_with_const.out new file mode 100644 index 00000000000..2694de5e468 --- /dev/null +++ b/regression-test/data/query_p0/join/test_join_with_const.out @@ -0,0 +1,8 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql1 -- +0 2024-10-31 1 \N \N \N +0 2024-11-01 1 0 2024-11-01 2 + +-- !sql1 -- +0 2024-10-31 1 \N \N \N +0 2024-11-01 1 0 2024-11-01 2 \ No newline at end of file diff --git a/regression-test/suites/query_p0/join/test_join_with_const.groovy b/regression-test/suites/query_p0/join/test_join_with_const.groovy new file mode 100644 index 00000000000..05e7a77011b --- /dev/null +++ b/regression-test/suites/query_p0/join/test_join_with_const.groovy @@ -0,0 +1,70 @@ +// 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_join_with_const", "query,p0") { + def left_table = "left_table" + def right_table = "right_table" + sql " drop table if exists ${left_table}; "; + sql " drop table if exists ${right_table}; "; + sql """ + create table ${left_table} (c1 datev2, c2 bigint sum) + aggregate key (c1) + DISTRIBUTED BY HASH(c1) + BUCKETS 3 + properties ("replication_num" = "1"); + """ + sql """ + create table ${right_table} (c1 datev2, c2 bigint sum) + aggregate key (c1) + DISTRIBUTED BY HASH(c1) + BUCKETS 3 + properties ("replication_num" = "1"); + """ + + sql """ insert into ${left_table} values ("2024-10-31", 1), ("2024-11-01", 1); """ + sql """ insert into ${right_table} values ("2024-11-01", 2); """ + + def join_sql_str = """ + select + * + from + ( + select 0 z, c1, sum(c2) c2 + from ${left_table} + group by 1, 2 + ) t1 + FULL JOIN [shuffle] + ( + select 0 z, c1, sum(c2) c2 + from ${right_table} + group by 1, 2 + ) t2 + on t1.z = t2.z + and t1.c1 = t2.c1 + order by t1.c1 + """ + + sql "set enable_nereids_planner = false;" + qt_sql1 "${join_sql_str}" + + sql "set enable_nereids_planner = true;" + qt_sql1 "${join_sql_str}" + + sql "drop table ${left_table}" + sql "drop table ${right_table}" + +} \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org