Skip to content

Commit

Permalink
JOIN filter push down filled join fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kitaisreal committed May 3, 2024
1 parent 49c91e3 commit 97a4113
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Processors/QueryPlan/Optimizations/filterPushDown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static size_t tryPushDownOverJoinStep(QueryPlan::Node * parent_node, QueryPlan::

bool has_single_clause = table_join.getClauses().size() == 1;

if (has_single_clause)
if (has_single_clause && !filled_join)
{
const auto & join_clause = table_join.getClauses()[0];
size_t key_names_size = join_clause.key_names_left.size();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 1 1 test
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1
(
id UInt64,
external_id UInt64
)
ENGINE = MergeTree
ORDER BY id;

DROP TABLE IF EXISTS t2;
CREATE TABLE t2
(
id UInt64,
name String
)
ENGINE = MergeTree
ORDER BY id;

INSERT INTO t1 VALUES (1, 1);

INSERT INTO t2 VALUES (1, 'test');

DROP DICTIONARY IF EXISTS d2;
CREATE DICTIONARY d2
(
id UInt64,
name String,
)
PRIMARY KEY id
SOURCE(CLICKHOUSE(
table t2))
LIFETIME(MIN 600 MAX 900)
LAYOUT(HASHED());

SELECT
*
FROM
t1
LEFT JOIN d2 ON d2.id = t1.external_id
WHERE t1.id = 1
LIMIT 1;

DROP DICTIONARY d2;
DROP TABLE t2;
DROP TABLE t1;

0 comments on commit 97a4113

Please sign in to comment.