Skip to content

Commit eae0a02

Browse files
committed
fix
1 parent faf482c commit eae0a02

File tree

12 files changed

+1305
-1243
lines changed

12 files changed

+1305
-1243
lines changed

tests/sqllogictests/suites/mode/standalone/explain/cte_filter_pushdown.test

Lines changed: 65 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -114,37 +114,37 @@ select * from cte1 as c1 where c1.a = 1
114114
union all
115115
select * from cte1 as c2 where c2.a = 2;
116116
----
117-
UnionAll
118-
├── output columns: [a (#4), cnt (#5)]
119-
├── estimated rows: 2.00
120-
├── Filter
121-
│ ├── output columns: [c1.a (#0), c1.cnt (#1)]
122-
│ ├── filters: [is_true(c1.a (#0) = 1)]
123-
│ ├── estimated rows: 1.00
117+
Sequence
118+
├── MaterializedCTE: cte_cse_0
124119
│ └── TableScan
125120
│ ├── table: default.default.cte1
126121
│ ├── output columns: [a (#0), cnt (#1)]
127122
│ ├── read rows: 3
128123
│ ├── read size: < 1 KiB
129124
│ ├── partitions total: 1
130125
│ ├── partitions scanned: 1
131-
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 1 to 1>]
132-
│ ├── push downs: [filters: [is_true(cte1.a (#0) = 1)], limit: NONE]
126+
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
127+
│ ├── push downs: [filters: [], limit: NONE]
133128
│ └── estimated rows: 3.00
134-
└── Filter
135-
├── output columns: [c2.a (#2), c2.cnt (#3)]
136-
├── filters: [is_true(c2.a (#2) = 2)]
137-
├── estimated rows: 1.00
138-
└── TableScan
139-
├── table: default.default.cte1
140-
├── output columns: [a (#2), cnt (#3)]
141-
├── read rows: 3
142-
├── read size: < 1 KiB
143-
├── partitions total: 1
144-
├── partitions scanned: 1
145-
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 1 to 1>]
146-
├── push downs: [filters: [is_true(cte1.a (#2) = 2)], limit: NONE]
147-
└── estimated rows: 3.00
129+
└── UnionAll
130+
├── output columns: [a (#4), cnt (#5)]
131+
├── estimated rows: 2.00
132+
├── Filter
133+
│ ├── output columns: [c1.a (#0), c1.cnt (#1)]
134+
│ ├── filters: [is_true(c1.a (#0) = 1)]
135+
│ ├── estimated rows: 1.00
136+
│ └── MaterializeCTERef
137+
│ ├── cte_name: cte_cse_0
138+
│ ├── cte_schema: [a (#0), cnt (#1)]
139+
│ └── estimated rows: 3.00
140+
└── Filter
141+
├── output columns: [c2.a (#2), c2.cnt (#3)]
142+
├── filters: [is_true(c2.a (#2) = 2)]
143+
├── estimated rows: 1.00
144+
└── MaterializeCTERef
145+
├── cte_name: cte_cse_0
146+
├── cte_schema: [a (#2), cnt (#3)]
147+
└── estimated rows: 3.00
148148

149149
# Test 6: Multiple CTE references with three different filters
150150
# Should create complex OR condition in CTE definition
@@ -160,54 +160,48 @@ select * from cte1 where a = 2
160160
union all
161161
select * from cte1 where a = 3;
162162
----
163-
UnionAll
164-
├── output columns: [a (#8), cnt (#9)]
165-
├── estimated rows: 3.00
166-
├── UnionAll
167-
│ ├── output columns: [a (#4), cnt (#5)]
168-
│ ├── estimated rows: 2.00
169-
│ ├── Filter
170-
│ │ ├── output columns: [cte1.a (#0), cte1.cnt (#1)]
171-
│ │ ├── filters: [is_true(cte1.a (#0) = 1)]
172-
│ │ ├── estimated rows: 1.00
173-
│ │ └── TableScan
174-
│ │ ├── table: default.default.cte1
175-
│ │ ├── output columns: [a (#0), cnt (#1)]
176-
│ │ ├── read rows: 3
177-
│ │ ├── read size: < 1 KiB
178-
│ │ ├── partitions total: 1
179-
│ │ ├── partitions scanned: 1
180-
│ │ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 1 to 1>]
181-
│ │ ├── push downs: [filters: [is_true(cte1.a (#0) = 1)], limit: NONE]
182-
│ │ └── estimated rows: 3.00
183-
│ └── Filter
184-
│ ├── output columns: [cte1.a (#2), cte1.cnt (#3)]
185-
│ ├── filters: [is_true(cte1.a (#2) = 2)]
186-
│ ├── estimated rows: 1.00
187-
│ └── TableScan
188-
│ ├── table: default.default.cte1
189-
│ ├── output columns: [a (#2), cnt (#3)]
190-
│ ├── read rows: 3
191-
│ ├── read size: < 1 KiB
192-
│ ├── partitions total: 1
193-
│ ├── partitions scanned: 1
194-
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 1 to 1>]
195-
│ ├── push downs: [filters: [is_true(cte1.a (#2) = 2)], limit: NONE]
196-
│ └── estimated rows: 3.00
197-
└── Filter
198-
├── output columns: [cte1.a (#6), cte1.cnt (#7)]
199-
├── filters: [is_true(cte1.a (#6) = 3)]
200-
├── estimated rows: 1.00
201-
└── TableScan
202-
├── table: default.default.cte1
203-
├── output columns: [a (#6), cnt (#7)]
204-
├── read rows: 3
205-
├── read size: < 1 KiB
206-
├── partitions total: 1
207-
├── partitions scanned: 1
208-
├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1, bloom pruning: 1 to 1>]
209-
├── push downs: [filters: [is_true(cte1.a (#6) = 3)], limit: NONE]
210-
└── estimated rows: 3.00
163+
Sequence
164+
├── MaterializedCTE: cte_cse_0
165+
│ └── TableScan
166+
│ ├── table: default.default.cte1
167+
│ ├── output columns: [a (#0), cnt (#1)]
168+
│ ├── read rows: 3
169+
│ ├── read size: < 1 KiB
170+
│ ├── partitions total: 1
171+
│ ├── partitions scanned: 1
172+
│ ├── pruning stats: [segments: <range pruning: 1 to 1>, blocks: <range pruning: 1 to 1>]
173+
│ ├── push downs: [filters: [], limit: NONE]
174+
│ └── estimated rows: 3.00
175+
└── UnionAll
176+
├── output columns: [a (#8), cnt (#9)]
177+
├── estimated rows: 3.00
178+
├── UnionAll
179+
│ ├── output columns: [a (#4), cnt (#5)]
180+
│ ├── estimated rows: 2.00
181+
│ ├── Filter
182+
│ │ ├── output columns: [cte1.a (#0), cte1.cnt (#1)]
183+
│ │ ├── filters: [is_true(cte1.a (#0) = 1)]
184+
│ │ ├── estimated rows: 1.00
185+
│ │ └── MaterializeCTERef
186+
│ │ ├── cte_name: cte_cse_0
187+
│ │ ├── cte_schema: [a (#0), cnt (#1)]
188+
│ │ └── estimated rows: 3.00
189+
│ └── Filter
190+
│ ├── output columns: [cte1.a (#2), cte1.cnt (#3)]
191+
│ ├── filters: [is_true(cte1.a (#2) = 2)]
192+
│ ├── estimated rows: 1.00
193+
│ └── MaterializeCTERef
194+
│ ├── cte_name: cte_cse_0
195+
│ ├── cte_schema: [a (#2), cnt (#3)]
196+
│ └── estimated rows: 3.00
197+
└── Filter
198+
├── output columns: [cte1.a (#6), cte1.cnt (#7)]
199+
├── filters: [is_true(cte1.a (#6) = 3)]
200+
├── estimated rows: 1.00
201+
└── MaterializeCTERef
202+
├── cte_name: cte_cse_0
203+
├── cte_schema: [a (#6), cnt (#7)]
204+
└── estimated rows: 3.00
211205

212206
# Test 8: CTE with existing filter condition and additional pushdown filter
213207
query T

0 commit comments

Comments
 (0)