JOIN filter push down filled join fix

This commit is contained in:
Maksim Kita 2024-05-01 14:40:50 +03:00
parent 49c91e3544
commit 97a411365d
3 changed files with 47 additions and 1 deletions

View File

@ -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();

View File

@ -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;