This is an automated email from the ASF dual-hosted git repository.
Mryange pushed a commit to branch groupjoin
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/groupjoin by this push:
new 762aa9fa04f [fix](be) Use build-side distribution expressions in
GroupJoin
762aa9fa04f is described below
commit 762aa9fa04f3f92e5ae4cacdfac56468c7cdf398
Author: Mryange <[email protected]>
AuthorDate: Thu Sep 10 23:10:35 2026 +0800
[fix](be) Use build-side distribution expressions in GroupJoin
### What problem does this PR solve?
Problem Summary: With serial exchange enabled and the local shuffle planner
disabled, GroupJoin build-side partitioning evaluates probe-side expressions
against build input and fails with invalid slot IDs. Select distribution
expression list 1 for the build side, matching ordinary Hash Join, while
the probe continues to use list 0.
Add regression coverage for serial exchange, local shuffle planning and
runtime filter combinations, including key-only grouping, COUNT/SUM and
composite keys. The original failing configuration and all six associated
historical SQL cases now return the expected results with GroupJoin active.
### Release note
Fix GroupJoin invalid-slot errors during build-side local partitioning.
### Check List (For Author)
- Test: ASAN BE build passed. Original reproducer passed three repetitions;
six historical fixtures passed both fusion modes against saved expected
results. Three focused regression suites passed. clang-format 16 and
git diff --check passed. clang-tidy was blocked by existing diagnostics
and a missing toolchain header. Validation used one rebuilt BE against
the unchanged FE that reproduced the issue; no three-BE test was run.
- Behavior changed: Yes, use the correct build input slots for partitioning.
- Does this need documentation: No
---
be/src/exec/operator/groupjoin_build_sink.cpp | 2 +-
.../test_group_join_build_distribution.out | 97 ++++++++++++++++++++++
.../test_group_join_build_distribution.groovy | 63 ++++++++++++++
3 files changed, 161 insertions(+), 1 deletion(-)
diff --git a/be/src/exec/operator/groupjoin_build_sink.cpp
b/be/src/exec/operator/groupjoin_build_sink.cpp
index 83718b2c829..fffc29a556e 100644
--- a/be/src/exec/operator/groupjoin_build_sink.cpp
+++ b/be/src/exec/operator/groupjoin_build_sink.cpp
@@ -122,7 +122,7 @@
GroupJoinBuildSinkOperatorX::GroupJoinBuildSinkOperatorX(ObjectPool* pool, int o
? tnode.group_join_node.dist_type
: TJoinDistributionType::NONE),
_pool(pool),
- _partition_exprs(tnode.__isset.distribute_expr_lists ?
tnode.distribute_expr_lists[0]
+ _partition_exprs(tnode.__isset.distribute_expr_lists ?
tnode.distribute_expr_lists[1]
:
std::vector<TExpr> {}),
_runtime_filter_descs(tnode.runtime_filters) {}
diff --git
a/regression-test/data/group_join_fusion_p0/test_group_join_build_distribution.out
b/regression-test/data/group_join_fusion_p0/test_group_join_build_distribution.out
new file mode 100644
index 00000000000..d0057c7a912
--- /dev/null
+++
b/regression-test/data/group_join_fusion_p0/test_group_join_build_distribution.out
@@ -0,0 +1,97 @@
+-- This file is automatically generated. You should know what you did if you
want to edit this
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
+-- !result --
+2023-12-11
+2023-12-12
+
+-- !result --
+2023-12-11 4 8 8
+2023-12-12 1 2 2
+
+-- !result --
+2023-12-11 a
+2023-12-12 b
+
diff --git
a/regression-test/suites/group_join_fusion_p0/test_group_join_build_distribution.groovy
b/regression-test/suites/group_join_fusion_p0/test_group_join_build_distribution.groovy
new file mode 100644
index 00000000000..4f7910cab26
--- /dev/null
+++
b/regression-test/suites/group_join_fusion_p0/test_group_join_build_distribution.groovy
@@ -0,0 +1,63 @@
+// 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_group_join_build_distribution") {
+ sql "DROP TABLE IF EXISTS gj_build_distribution"
+ sql """CREATE TABLE gj_build_distribution (
+ id INT NOT NULL, k DATE NULL, s VARCHAR(16) NULL
+ ) DUPLICATE KEY(id) DISTRIBUTED BY HASH(id) BUCKETS 3
+ PROPERTIES ("replication_num"="1")"""
+ sql """INSERT INTO gj_build_distribution VALUES
+ (1,'2023-12-11','a'),(2,'2023-12-12','b'),(3,'2023-12-11','a')"""
+ sql "SET enable_sql_cache=false"
+ sql "SET query_cache_force_refresh=true"
+ sql "SET eager_agg_broadcast_row_count=0"
+ sql "SET broadcast_row_count_limit=0"
+ sql "SET agg_phase=1"
+ sql "SET eager_aggregation_mode=-1"
+ sql "SET enable_bucket_shuffle_join=false"
+ sql "SET parallel_pipeline_task_num=4"
+ def queries = [
+ """SELECT l.k FROM gj_build_distribution l JOIN [shuffle]
gj_build_distribution r
+ ON l.k=r.k GROUP BY l.k ORDER BY l.k""",
+ """SELECT l.k, COUNT(*), SUM(l.id), SUM(r.id)
+ FROM gj_build_distribution l JOIN [shuffle] gj_build_distribution r
+ ON l.k=r.k GROUP BY l.k ORDER BY l.k""",
+ """SELECT l.k,l.s FROM gj_build_distribution l JOIN [shuffle]
gj_build_distribution r
+ ON l.k=r.k AND l.s=r.s GROUP BY l.k,l.s ORDER BY l.k,l.s"""
+ ]
+ for (serial in [true, false]) {
+ sql "SET experimental_use_serial_exchange=${serial}"
+ for (planner in [false, true]) {
+ sql "SET experimental_enable_local_shuffle_planner=${planner}"
+ for (mode in ['OFF', 'GLOBAL']) {
+ sql "SET runtime_filter_mode='${mode}'"
+ for (query in queries) {
+ sql "SET experimental_enable_group_join_fusion=false"
+ def reference = sql query
+ sql "SET experimental_enable_group_join_fusion=true"
+ explain {
+ sql query
+ contains "VGROUP JOIN"
+ }
+ assertEquals(reference, sql(query))
+ qt_result query
+ }
+ }
+ }
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]