-
Notifications
You must be signed in to change notification settings - Fork 734
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: push filter down join with materialized cte (#16349)
- Loading branch information
Showing
2 changed files
with
80 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...standalone/explain/push_down_filter/push_down_filter_join/push_down_filter_self_join.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
statement ok | ||
create table t1 as select number as a, number as b from numbers(10); | ||
|
||
statement ok | ||
create table t2 as select number as a, number as b from numbers(10); | ||
|
||
query T | ||
explain with A as materialized (select * from t1 union all select * from t2), | ||
B as (select * from A), | ||
C as (select * from B as b1 left outer join B as b2 on b1.a = b2.a where b1.b < b2.b), | ||
D as (select * from C) | ||
select * from D; | ||
---- | ||
MaterializedCTE | ||
├── output columns: [t1.a (#0), t1.b (#1)] | ||
├── UnionAll | ||
│ ├── output columns: [t1.a (#0), t1.b (#1)] | ||
│ ├── estimated rows: 20.00 | ||
│ ├── TableScan | ||
│ │ ├── table: default.default.t1 | ||
│ │ ├── output columns: [a (#0), b (#1)] | ||
│ │ ├── read rows: 10 | ||
│ │ ├── read size: < 1 KiB | ||
│ │ ├── partitions total: 1 | ||
│ │ ├── partitions scanned: 1 | ||
│ │ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>] | ||
│ │ ├── push downs: [filters: [], limit: NONE] | ||
│ │ └── estimated rows: 10.00 | ||
│ └── TableScan | ||
│ ├── table: default.default.t2 | ||
│ ├── output columns: [a (#2), b (#3)] | ||
│ ├── read rows: 10 | ||
│ ├── read size: < 1 KiB | ||
│ ├── partitions total: 1 | ||
│ ├── partitions scanned: 1 | ||
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>] | ||
│ ├── push downs: [filters: [], limit: NONE] | ||
│ └── estimated rows: 10.00 | ||
└── HashJoin | ||
├── output columns: [t1.a (#0), t1.b (#1)] | ||
├── join type: INNER | ||
├── build keys: [b2.a (#0)] | ||
├── probe keys: [b1.a (#0)] | ||
├── filters: [b1.b (#1) < b2.b (#1)] | ||
├── estimated rows: 10.00 | ||
├── CTEScan(Build) | ||
│ ├── CTE index: 0, sub index: 2 | ||
│ └── estimated rows: 10.00 | ||
└── CTEScan(Probe) | ||
├── CTE index: 0, sub index: 1 | ||
└── estimated rows: 10.00 |