mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #50467 from ClickHouse/revert-50430-hanfei/fix-crossjoin-filter-pushdown
Revert "make filter push down through cross join"
This commit is contained in:
commit
ca1a3f81a6
@ -272,7 +272,7 @@ size_t tryPushDownFilter(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes
|
||||
{
|
||||
/// If totals step has HAVING expression, skip it for now.
|
||||
/// TODO:
|
||||
/// We can merge HAVING expression with current filter.
|
||||
/// We can merge HAVING expression with current filer.
|
||||
/// Also, we can push down part of HAVING which depend only on aggregation keys.
|
||||
if (totals_having->getActions())
|
||||
return 0;
|
||||
@ -323,9 +323,9 @@ size_t tryPushDownFilter(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes
|
||||
{
|
||||
const auto & table_join = join ? join->getJoin()->getTableJoin() : filled_join->getJoin()->getTableJoin();
|
||||
|
||||
/// Only inner, cross and left(/right) join are supported. Other types may generate default values for left table keys.
|
||||
/// Only inner and left(/right) join are supported. Other types may generate default values for left table keys.
|
||||
/// So, if we push down a condition like `key != 0`, not all rows may be filtered.
|
||||
if (table_join.kind() != JoinKind::Inner && table_join.kind() != JoinKind::Cross && table_join.kind() != kind)
|
||||
if (table_join.kind() != JoinKind::Inner && table_join.kind() != kind)
|
||||
return 0;
|
||||
|
||||
bool is_left = kind == JoinKind::Left;
|
||||
|
@ -6,22 +6,3 @@ String1_0 String2_0 String3_0 String4_0 1
|
||||
String1_0 String2_0 String3_0 String4_0 1
|
||||
1 [0,1,2]
|
||||
1
|
||||
Expression ((Projection + Before ORDER BY))
|
||||
Filter (WHERE)
|
||||
Join (JOIN FillRightFirst)
|
||||
Filter (( + Before JOIN))
|
||||
ReadFromMergeTree (default.t1)
|
||||
Indexes:
|
||||
PrimaryKey
|
||||
Keys:
|
||||
id
|
||||
Condition: (id in [101, 101])
|
||||
Parts: 1/1
|
||||
Granules: 1/1
|
||||
Expression ((Joined actions + (Rename joined columns + (Projection + Before ORDER BY))))
|
||||
ReadFromMergeTree (default.t2)
|
||||
Indexes:
|
||||
PrimaryKey
|
||||
Condition: true
|
||||
Parts: 1/1
|
||||
Granules: 1/1
|
||||
|
@ -38,25 +38,6 @@ DROP TABLE IF EXISTS Test;
|
||||
|
||||
select x, y from (select [0, 1, 2] as y, 1 as a, 2 as b) array join y as x where a = 1 and b = 2 and (x = 1 or x != 1) and x = 1;
|
||||
|
||||
DROP TABLE IF EXISTS t;
|
||||
create table t(a UInt8) engine=MergeTree order by a;
|
||||
insert into t select * from numbers(2);
|
||||
select a from t t1 join t t2 on t1.a = t2.a where t1.a;
|
||||
DROP TABLE IF EXISTS t;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (id Int64, create_time DateTime) ENGINE = MergeTree ORDER BY id;
|
||||
CREATE TABLE t2 (delete_time DateTime) ENGINE = MergeTree ORDER BY delete_time;
|
||||
|
||||
insert into t1 values (101, '2023-05-28 00:00:00'), (102, '2023-05-28 00:00:00');
|
||||
insert into t2 values ('2023-05-31 00:00:00');
|
||||
|
||||
EXPLAIN indexes=1 SELECT id, delete_time FROM t1
|
||||
CROSS JOIN (
|
||||
SELECT delete_time
|
||||
FROM t2
|
||||
) AS d WHERE create_time < delete_time AND id = 101;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
|
Loading…
Reference in New Issue
Block a user