feat: exec pushdown with global aggregates#124
Merged
Conversation
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces P0 subplan pushdown for ungrouped aggregates over Lance scans.
Key points:
Tests: