Commit 1691b07
fix: push OFFSET through CoalescePartitionsExec to DataSourceExec
When a single parquet file is split into multiple byte-range partitions,
CoalescePartitionsExec sits between GlobalLimitExec and DataSourceExec.
Previously, the optimizer would keep the GlobalLimitExec for the skip,
meaning offset wasn't pushed to the parquet reader.
Now we try to push the offset through the combining operator to its
DataSourceExec child, which uses a shared Arc<AtomicUsize> counter to
coordinate offset consumption across partitions. This eliminates the
GlobalLimitExec entirely for supported sources.
Result on 14GB hits.parquet: OFFSET 99M LIMIT 5 from 3.2s → 29ms.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 2028426 commit 1691b07
3 files changed
Lines changed: 35 additions & 7 deletions
File tree
- datafusion
- datasource-parquet/src
- physical-optimizer/src
- sqllogictest/test_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
297 | 302 | | |
298 | 303 | | |
299 | 304 | | |
| |||
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
| 327 | + | |
322 | 328 | | |
323 | 329 | | |
324 | 330 | | |
| |||
553 | 559 | | |
554 | 560 | | |
555 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
556 | 571 | | |
557 | 572 | | |
558 | 573 | | |
559 | 574 | | |
560 | 575 | | |
561 | 576 | | |
562 | 577 | | |
563 | | - | |
564 | | - | |
565 | | - | |
| 578 | + | |
566 | 579 | | |
567 | 580 | | |
568 | 581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
221 | 219 | | |
222 | | - | |
223 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
224 | 238 | | |
225 | 239 | | |
226 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2374 | 2374 | | |
2375 | 2375 | | |
2376 | 2376 | | |
| 2377 | + | |
2377 | 2378 | | |
2378 | 2379 | | |
2379 | 2380 | | |
| |||
0 commit comments