Skip to content

feat(core): add fuzzy matching suggestions for missing columns (#5642)#5979

Open
SIDDHESH-8213 wants to merge 2 commits intolance-format:mainfrom
SIDDHESH-8213:feat/typo-suggestions
Open

feat(core): add fuzzy matching suggestions for missing columns (#5642)#5979
SIDDHESH-8213 wants to merge 2 commits intolance-format:mainfrom
SIDDHESH-8213:feat/typo-suggestions

Conversation

@SIDDHESH-8213
Copy link

Description

This PR addresses issue #5642 by implementing fuzzy matching suggestions for ColumnNotFound errors. When a user attempts to access a field that does not exist in the schema, the engine now calculates the Levenshtein distance against available fields and suggests the closest match if it falls within a threshold (edit distance ≤ 2).

Changes

  • Dependency Update: Added strsim to lance-core to handle string similarity metrics.
  • Error Enhancement:
    • Updated do_project in schema.rs to provide "Did you mean...?" suggestions during projections.
    • Updated FieldRef::into_id to include similar suggestions for path-based lookups.
  • Helper Logic: Introduced suggest_closest_column as a private helper function to keep the fuzzy matching logic reusable and encapsulated.

Testing performed

  • Unit Test: Added test_schema_typo_suggestion to verify both top-level projections and nested path resolutions.
  • Verification: Confirmed the following typo resolutions pass:
    • "vctor" -> "vector"
    • "timstamp" -> "timestamp"
  • Regression: Ran the full lance-core test suite to ensure no regressions in schema validation or resolution logic.

Related Issues

Closes #5642

@github-actions github-actions bot added the enhancement New feature or request label Feb 22, 2026
@wjones127
Copy link
Contributor

Hey thanks for creating a PR. I think this is being concurrently worked on in #5976. You can see I have similar feedback there. Perhaps you can help review that one and work on a follow up PR once that one is complete?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance not found errors with suggestions

3 participants