Skip to content

Implement support for SQL Server vector search #36383

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

roji
Copy link
Member

@roji roji commented Jul 17, 2025

Note: this does not include VECTOR_SEARCH[] translation support (as opposed to VECTOR_DISTANCE() which is included); this is tracked by #36384.

Closes #34659

@roji roji marked this pull request as ready for review July 17, 2025 21:30
@roji roji requested a review from a team as a code owner July 17, 2025 21:30
@roji roji requested a review from Copilot July 17, 2025 21:30
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements SQL Server vector search support for Entity Framework Core, adding the ability to work with SQL Server's VECTOR data type and related functions. The implementation provides type mapping, query translation, and validation for vector operations.

Key changes include:

  • Added SqlServerVectorTypeMapping for SQL Server's VECTOR type with proper dimensions support
  • Implemented query translation for vector distance functions and vector properties
  • Added model validation to ensure vector properties are properly configured and not used in unsupported scenarios

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
SqlServerVectorTypeMapping.cs New type mapping class for SQL Server vector type with custom comparer and literal generation
SqlServerVectorTranslator.cs Query translator for vector functions (VectorDistance) and vector member access (Length)
SqlServerTypeMappingSource.cs Updated to register vector type mapping and handle SqlVector<float> CLR type
SqlServerModelValidator.cs Added validation for vector properties requiring dimensions and preventing use in JSON
SqlServerDbFunctionsExtensions.cs Added VectorDistance function extension for calculating distances between vectors
SqlServerDatabaseModelFactory.cs Updated scaffolding to properly handle vector columns and dimensions
Test files Comprehensive test coverage for vector functionality, type mapping, and query translation
Files not reviewed (1)
  • src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs: Language not supported

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL Server: bring vector search support into the provider
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy