Commit 114f643
committed
refactor(spill): unify window/cte spill to async_buffer path
Migrate WindowPartitionBufferV2 and MaterializedCTE from the
BackpressureSpiller -> WriterCreator -> SpillWriter -> AnyFileWriter
chain to the SpillsBufferPool -> SpillsDataWriter/SpillsDataReader
path used by aggregate and join operators.
Key changes:
- Rewrite window_partition_buffer_v2 to use SpillsDataWriter directly
- Rewrite materialized_cte to use SpillsBufferPool.writer()
- Remove BackpressureSpiller, WriterCreator, SpillWriter, SpillReader
- Remove row_group_encoder.rs (FileWriter, LocalWriter, AnyFileWriter,
RowGroupEncoder, Properties, RangeFetchPlan, FileReader)
- Remove V1 WindowPartitionBuffer (async Spiller path)
- Drop local DMA support for window/cte spill
- Add SpillsDataWriter::flush_row_group() for explicit row group control
Reduce from 5-state machine (Collect/Spill/Process/Restore/Finish) to
3-state (Collect/Output/Finish). Since spill and restore are now both
synchronous, the indirection through separate Spill/Restore steps with
async fallback is unnecessary.
- Collect: pull data, buffer, spill inline when memory pressure is high
- Output: restore next partition, process (sort), push downstream
- Remove next_step(), collect(), output() helper methods
- Remove is_collect_finished, restored_data_blocks fields1 parent db6b04e commit 114f643
15 files changed
Lines changed: 462 additions & 1794 deletions
File tree
- src/query/service/src
- physical_plans
- pipelines/processors/transforms
- window/partition
- spillers
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
124 | | - | |
125 | | - | |
126 | 123 | | |
127 | 124 | | |
128 | 125 | | |
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| |||
Lines changed: 0 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
58 | 56 | | |
59 | 57 | | |
60 | 58 | | |
61 | | - | |
62 | 59 | | |
63 | | - | |
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
| |||
334 | 330 | | |
335 | 331 | | |
336 | 332 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | 333 | | |
349 | 334 | | |
350 | 335 | | |
| |||
366 | 351 | | |
367 | 352 | | |
368 | 353 | | |
369 | | - | |
370 | 354 | | |
371 | 355 | | |
372 | 356 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
| |||
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
| |||
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | | - | |
83 | | - | |
84 | 80 | | |
85 | 81 | | |
86 | 82 | | |
| |||
473 | 469 | | |
474 | 470 | | |
475 | 471 | | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | 472 | | |
487 | 473 | | |
488 | 474 | | |
| |||
498 | 484 | | |
499 | 485 | | |
500 | 486 | | |
501 | | - | |
502 | 487 | | |
503 | 488 | | |
504 | 489 | | |
| |||
Lines changed: 0 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
38 | 36 | | |
39 | 37 | | |
40 | 38 | | |
41 | | - | |
42 | | - | |
43 | 39 | | |
44 | 40 | | |
45 | 41 | | |
| |||
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | 144 | | |
159 | 145 | | |
160 | 146 | | |
| |||
171 | 157 | | |
172 | 158 | | |
173 | 159 | | |
174 | | - | |
175 | 160 | | |
176 | 161 | | |
177 | 162 | | |
| |||
0 commit comments