From c29be90fd62aa251d5bcb2f008bee55b30b9f8ab Mon Sep 17 00:00:00 2001 From: vdimir Date: Wed, 13 Nov 2024 11:23:41 +0000 Subject: [PATCH] Remove excess check in HashJoinMethodsImpl.h --- src/Interpreters/HashJoin/HashJoinMethodsImpl.h | 5 ----- ...259_join_condition_executed_block_bug.reference | 0 .../03259_join_condition_executed_block_bug.sql | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 tests/queries/0_stateless/03259_join_condition_executed_block_bug.reference create mode 100644 tests/queries/0_stateless/03259_join_condition_executed_block_bug.sql diff --git a/src/Interpreters/HashJoin/HashJoinMethodsImpl.h b/src/Interpreters/HashJoin/HashJoinMethodsImpl.h index 45a766e2df6..250564b5d60 100644 --- a/src/Interpreters/HashJoin/HashJoinMethodsImpl.h +++ b/src/Interpreters/HashJoin/HashJoinMethodsImpl.h @@ -529,11 +529,6 @@ ColumnPtr HashJoinMethods::buildAdditionalFilter } right_col_pos += 1; } - if (!executed_block) - { - result_column = ColumnUInt8::create(); - break; - } for (const auto & col_name : required_column_names) { diff --git a/tests/queries/0_stateless/03259_join_condition_executed_block_bug.reference b/tests/queries/0_stateless/03259_join_condition_executed_block_bug.reference new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/queries/0_stateless/03259_join_condition_executed_block_bug.sql b/tests/queries/0_stateless/03259_join_condition_executed_block_bug.sql new file mode 100644 index 00000000000..096e0f3835d --- /dev/null +++ b/tests/queries/0_stateless/03259_join_condition_executed_block_bug.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; + +CREATE TABLE t1 (key String, attr String, a UInt64, b UInt64, c Nullable(UInt64)) ENGINE = MergeTree ORDER BY key; +CREATE TABLE t2 (key String, attr String, a UInt64, b UInt64, c Nullable(UInt64)) ENGINE = MergeTree ORDER BY key; + +INSERT INTO t1 VALUES ('key1', 'a', 1, 1, 2), ('key1', 'b', 2, 3, 2), ('key1', 'c', 3, 2, 1), ('key1', 'd', 4, 7, 2), ('key1', 'e', 5, 5, 5), ('key2', 'a2', 1, 1, 1), ('key4', 'f', 2, 3, 4); +INSERT INTO t2 VALUES ('key1', 'A', 1, 2, 1), ('key1', 'B', 2, 1, 2), ('key1', 'C', 3, 4, 5), ('key1', 'D', 4, 1, 6), ('key3', 'a3', 1, 1, 1), ('key4', 'F', 1,1,1); + +SET allow_experimental_join_condition = true; +SET allow_experimental_analyzer = true; + +SELECT t1.* FROM t1 FULL OUTER JOIN t2 ON t1.key = t2.key AND (t1.a = 2 OR indexHint(t2.a = 2)) FORMAT Null +;