lance-format / lance-format/lance

Expose DataFusion extensions (plan nodes, plan optimizer rules)

Open
#1,782 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement rust
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 _rowid and _distance less awkward to deal with -- so that select([]).with_row_id() is just select ("_rowid") We should reserve that column name.
  • don't return _distance unless select * or select _distance

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.