-
Notifications
You must be signed in to change notification settings - Fork 284
enable to use l2 index for queries with l2sq #22833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
|
You are nearing your monthly Qodo Merge usage quota. For more information, please visit here. PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #22832
What this PR does / why we need it:
If a table has vector index with distance type l2, queries with l2sq distance function should be able to use this index.
PR Type
Enhancement
Description
Enable L2 index usage for L2sq distance queries
Store original distance function name in index configuration
Transform distances based on original function type
Support distance metric conversion between L2 and L2sq
Diagram Walkthrough
File Walkthrough
apply_indices_hnsw.go
Add original function name to HNSW configpkg/sql/plan/apply_indices_hnsw.go
origFuncNamevariableorig_func_nameparameter to HNSW table function configurationapply_indices_ivfflat.go
Add original function name to IVFFlat configpkg/sql/plan/apply_indices_ivfflat.go
origFuncNamevariableorig_func_nameparameter to IVFFlat table function configurationsearch.go
Use original function name for distance transformationpkg/vectorindex/hnsw/search.go
DistFuncNameToMetricTypemapping with original function nameUpdateConfigto preserve original function namesearch.go
Use original function name for distance transformationpkg/vectorindex/ivfflat/search.go
DistFuncNameToMetricTypemapping with original function nameUpdateConfigto preserve original function nametypes.go
Support L2sq to L2 distance transformationpkg/vectorindex/metric/types.go
DistanceTransformHnswto acceptMetricTypeinstead of stringDistanceTransformIvfflatto acceptMetricTypeparametersmetric
types.go
Add original function name to config structpkg/vectorindex/types.go
OrigFuncNamefield toIndexTableConfigstruct