Commit 5a097f0
authored
feat: exec pushdown with global aggregates (#124)
* Exec pushdown: internal __lance_exec for global aggregates
Add a small ExecIR container (reusing existing FilterIR bytes) and an optimizer rewrite that replaces ungrouped aggregates over Lance scans with the internal __lance_exec table function.
The Rust side validates the IR and executes it via DataFusion on top of the Lance scanner, returning a (typically tiny) Arrow stream back to DuckDB.
The rewrite is always enabled but remains conservative: on any encode/validate/type mismatch it falls back to the original plan.
Tests: GEN=ninja make test_debug
* Fix ci
* Fix exec pushdown on table_filters-keyed scans
LogicalGet.table_filters uses column IDs as map keys, not scan column positions. Exec pushdown previously fed these filters into BuildLanceTableFilterIRParts with a column_ids vector sized to the projected columns, causing all_filters_pushed=false and a silent fallback for TPC-H Q6.
Fix by using an identity column_ids mapping sized by the max filter column id and collecting extra scan columns by column id.
Add a sqllogictest that asserts Q6 rewrites to __lance_exec.
Tests: GEN=ninja make test_debug
* Enable always-on exec pushdown for group/order aggregates
* Fix sqllogictest expectations under always-on exec pushdown
* ExecIR: encode CAST to preserve GROUP BY semantics
* Add formatting requirement to AGENTS1 parent 1fec57c commit 5a097f0
25 files changed
Lines changed: 2785 additions & 19 deletions
File tree
- rust
- ffi
- src
- include
- test/sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
120 | 123 | | |
| 124 | + | |
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
0 commit comments