Commit e61ed87
committed
Propagate WITH clause to subsequent SELECTs in UNION queries
In ClickHouse's EXPLAIN AST output, the WITH clause from the first
SELECT in a UNION ALL/UNION query is propagated to subsequent SELECTs.
The inherited WITH clause is output at the END of children for those
subsequent SELECT queries.
This fix applies the same WITH clause propagation logic that was
already implemented for INTERSECT/EXCEPT queries to plain UNION queries.
Fixes tests:
- 01515_with_global_and_with_propagation (stmt5, stmt11)
- 03671_pk_in_subquery_context_expired (stmt7)
- 03611_uniqExact_bug (stmt2)
- 03033_analyzer_resolve_from_parent_scope (stmt4)
- 01236_graphite_mt (stmt4)1 parent f1f302b commit e61ed87
6 files changed
Lines changed: 19 additions & 28 deletions
File tree
- internal/explain
- parser/testdata
- 01236_graphite_mt
- 01515_with_global_and_with_propagation
- 03033_analyzer_resolve_from_parent_scope
- 03611_uniqExact_bug
- 03671_pk_in_subquery_context_expired
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
Lines changed: 1 addition & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 1 | + | |
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
Lines changed: 1 addition & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
0 commit comments