Skip to content

refactor: remove scoring autoprojection deprecation and commit to new behavior#7059

Draft
westonpace wants to merge 6 commits into
lance-format:mainfrom
westonpace:refactor-do-not-auto-project-by-default
Draft

refactor: remove scoring autoprojection deprecation and commit to new behavior#7059
westonpace wants to merge 6 commits into
lance-format:mainfrom
westonpace:refactor-do-not-auto-project-by-default

Conversation

@westonpace
Copy link
Copy Markdown
Member

Scoring autoprojection (automatically appending _distance/_score to the output when an explicit projection is specified) has been removed. The new permanent behavior matches what disable_scoring_autoprojection previously opted into:

  • No explicit projection (SELECT *): _distance/_score are still appended automatically.
  • Explicit projection without _distance/_score: they are NOT added.
  • Explicit projection that includes _distance/_score: they appear as requested.

The disable_scoring_autoprojection flag is kept to avoid breaking callers that had opted in. However, the legacy behavior is being removed (we have warned about this for nearly a year):

  • True / None: silently accepted (new default is already active).
  • False: raises an error directing users to include the column explicitly.

westonpace and others added 2 commits June 2, 2026 17:00
…vior

Scoring autoprojection (automatically appending `_distance`/`_score` to
the output when an explicit projection is specified) has been removed.
The new permanent behavior matches what `disable_scoring_autoprojection`
previously opted into:

- No explicit projection (SELECT *): `_distance`/`_score` are still
  appended automatically.
- Explicit projection without `_distance`/`_score`: they are NOT added.
- Explicit projection that includes `_distance`/`_score`: they appear as
  requested.

The `disable_scoring_autoprojection` flag is kept to avoid breaking
callers:
- `True` / `None`: silently accepted (new default is already active).
- `False`: raises an error directing users to include the column
  explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added the A-python Python bindings label Jun 2, 2026
Comment on lines 3802 to 3804
tbl = dataset.scanner(
columns=["_rowid", "vec"], nearest=nearest, disable_scoring_autoprojection=False
columns=["_rowid", "vec", "_distance"], nearest=nearest
).to_table()
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove cases that explicitly set disable_scoring_autoprojection=False. These were intended to test the flag. We don't support the legacy behavior anymore so the test case isn't needed.

since = "0.0.0",
note = "Scoring autoprojection has been removed. This method is a no-op."
)]
pub fn disable_scoring_autoprojection(&mut self) -> &mut Self {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and remove this method. Rust has compile-time checks so we don't have to keep old flags / methods around.

westonpace and others added 2 commits June 2, 2026 17:10
- Remove the `disable_scoring_autoprojection` Rust method entirely
  (Rust has compile-time checks, no need to keep a no-op around)
- Drop test cases that exercised the now-removed `False` legacy behavior

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion

After removing _distance/_score autoprojection for explicit projections,
update tests and internal code to request these columns explicitly:

- mem_wal vector_search.rs: add _distance to BaseTable/FlushedMemTable
  scanner projections (build_scanner_projection strips it; now re-added)
- mem_wal fts_search.rs: add _score to BaseTable/FlushedMemTable
  scanner projections similarly
- udtf.rs: add _score to FtsTableProvider schema so DataFusion exposes
  it as a selectable column; handle score_idx in projection mapping
- scanner.rs tests: add _distance explicitly in tests that use explicit
  projections but expect distance in output; remove incorrect +1 in
  run_query helper for use_projection=true
- knn.rs: use project(&["_distance"]) instead of empty Vec projection
- Python tests: add _distance/_score to explicit projection lists where
  tests access those columns; update test_dynamic_projection assertion

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 8, 2026

Codecov Report

❌ Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...lance/src/dataset/mem_wal/scanner/vector_search.rs 75.00% 0 Missing and 2 partials ⚠️
rust/lance/src/dataset/scanner.rs 94.73% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

westonpace and others added 2 commits June 8, 2026 14:06
The upstream lance-format/lance main still calls
`scanner.disable_scoring_autoprojection()` from the Java JNI
blocking_scanner.rs. Keep the method as a deprecated no-op so the
merged CI build compiles.

Also fix test_indexed_vector_scan assertion: explicit columns=["price"]
no longer auto-appends _distance, so num_columns is 1 not 2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The #[deprecated] attribute caused clippy to treat the call in the
upstream blocking_scanner.rs as an error (-D warnings). Remove the
deprecation so the method is a silent no-op until the upstream callers
are updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-python Python bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant