lance-format / lance-format/lance

Support logical OR of `IndexedExpression` when there is both a `scalar_query` and a `refine`

Open
#1,550 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
7.1k
Forks
852
Avg merge
3d 18h
Merged PRs (30d)
272

Description

Currently we do not take advantage of the index when the query is something like this (assume "color" is indexed and "size" is not indexed)

(color == 'blue' AND size < 20) OR (color == 'red' AND size < 50)

We should be able to rewrite this to:

(color == 'blue' OR color == 'red') AND ((color == 'blue' AND size < 20) OR (color == 'red' AND size < 50))

The first part can become an index lookup and then the second part can become the refine expression.

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 by locating the IndexedExpression handling for queries containing both scalar_query and refine. Trace how the example OR expression is currently processed, then verify that the indexed portion can be extracted while the full condition remains as the refine expression. Done means the documented rewrite is supported without losing either condition.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.