diff --git a/src/Processors/QueryPlan/Optimizations/filterPushDown.cpp b/src/Processors/QueryPlan/Optimizations/filterPushDown.cpp index ebf780bb692e..5eab5e8f4a46 100644 --- a/src/Processors/QueryPlan/Optimizations/filterPushDown.cpp +++ b/src/Processors/QueryPlan/Optimizations/filterPushDown.cpp @@ -363,7 +363,7 @@ static size_t tryPushDownOverJoinStep(QueryPlan::Node * parent_node, QueryPlan:: JoinKind::Left); } - if (join_filter_push_down_actions.right_stream_filter_to_push_down) + if (join_filter_push_down_actions.right_stream_filter_to_push_down && allow_push_down_to_right) { updated_steps += addNewFilterStepOrThrow(parent_node, nodes, diff --git a/tests/queries/0_stateless/03095_join_filter_push_down_right_stream_filled.reference b/tests/queries/0_stateless/03095_join_filter_push_down_right_stream_filled.reference new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/queries/0_stateless/03095_join_filter_push_down_right_stream_filled.sql b/tests/queries/0_stateless/03095_join_filter_push_down_right_stream_filled.sql new file mode 100644 index 000000000000..4ce7657e1487 --- /dev/null +++ b/tests/queries/0_stateless/03095_join_filter_push_down_right_stream_filled.sql @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS t1__fuzz_0; +CREATE TABLE t1__fuzz_0 +( + `x` UInt8, + `str` String +) +ENGINE = MergeTree ORDER BY x; + +INSERT INTO t1__fuzz_0 SELECT number, toString(number) FROM numbers(10); + +DROP TABLE IF EXISTS left_join__fuzz_2; +CREATE TABLE left_join__fuzz_2 +( + `x` UInt32, + `s` LowCardinality(String) +) ENGINE = Join(`ALL`, LEFT, x); + +INSERT INTO left_join__fuzz_2 SELECT number, toString(number) FROM numbers(10); + +SELECT 14 FROM t1__fuzz_0 LEFT JOIN left_join__fuzz_2 USING (x) +WHERE pointInPolygon(materialize((-inf, 1023)), [(5, 0.9998999834060669), (1.1920928955078125e-7, 100.0000991821289), (1.000100016593933, 100.0000991821289)]) +ORDER BY toNullable('202.79.32.10') DESC NULLS LAST, toNullable(toLowCardinality(toUInt256(14))) ASC, x DESC NULLS LAST; + +DROP TABLE t1__fuzz_0; +DROP TABLE left_join__fuzz_2;