lance-format / lance-format/lance
Expose DataFusion extensions (plan nodes, plan optimizer rules)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.1k
- Forks
- 852
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 272
Description
The code in dataset/scanner.rs has gotten extremely complicated, to a point where it is hard to test. Before we make any improvements, we need to refactor this to be easier to test and extend.
In addition, outside codebases may wish to extend Lance's capabilities by modifying or composing plans. For example, in LanceDB, we'll want to add a separate WAL that needs to be queried during KNN queries and scans.
Tasks
- Create a LogicalPlan for KNN search
- Write an extension for LogicalPlanBuilder and rewrite
Scanner::create_plan()in terms of that. - Create a custom PhysicalPlanner to convert out logical plans into relevant nodes
- Implement a PhysicalOptimizerRule for each of the optimizations we make:
- Using vector indices (ANN)
- Using scalar indices (ANN and scan)
- Make sure schema returned from scanner comes from the logical plan.
- metadata is returned sometimes but not all times. Make this behavior more consistent.
- make
_rowidand_distanceless awkward to deal with -- so thatselect([]).with_row_id()is justselect ("_rowid")We should reserve that column name. - don't return
_distanceunlessselect *orselect _distance
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rust/lance/src/dataset/scanner.rs and review the linked DataFusion LogicalPlan, LogicalPlanBuilder, PhysicalPlanner, and PhysicalOptimizerRule interfaces. Trace Scanner::create_plan() and map the listed KNN, optimizer, schema, metadata, _rowid, and _distance tasks to the relevant plan boundaries. Done means the requested extensions and consistent scanner behavior are implemented across the checklist.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, databases
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100