Skip to content

[VECTOR_FLOAT16] Implement feature extension and version negotiation for Vector v2 support#2868

Open
muskan124947 wants to merge 8 commits intomainfrom
vector_FE_v2
Open

[VECTOR_FLOAT16] Implement feature extension and version negotiation for Vector v2 support#2868
muskan124947 wants to merge 8 commits intomainfrom
vector_FE_v2

Conversation

@muskan124947
Copy link
Contributor

@muskan124947 muskan124947 commented Dec 22, 2025

Description

For upcoming VECTOR_FLOAT16 support in the Microsoft JDBC Driver for SQL Server, this PR introduces the initial framework for vector type support handling on the client side, enabling controlled negotiation of vector capabilities between client and server.

The changes focus on making vector support explicit, extensible, and future-proof, in preparation for additional vector versions and data types.

Vector Version Negotiation Flow

  • The client vector setting is parsed and validated:
off – vector support disabled
v1 – float32 vector support
v2 – float32 and float16 vector support
  • If either the client disables vectors or the server does not support vectors, vector support is disabled.
  • The client and server determine their maximum supported vector versions.
  • When both support vectors, the negotiated version is the minimum of the client and server versions.
  • The negotiated version is used for all vector-related operations for the connection.

Impact

  • Backward compatibility: Clients using only float32 continue to work without changes.
  • Performance: Float16 support reduces memory usage and network payload for supported operations.
  • Extensibility: Framework allows easy addition of future vector types and versions.

@muskan124947 muskan124947 self-assigned this Dec 22, 2025
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 50.90909% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.20%. Comparing base (19d385f) to head (f09d152).

Files with missing lines Patch % Lines
.../microsoft/sqlserver/jdbc/SQLServerConnection.java 44.82% 12 Missing and 4 partials ⚠️
.../com/microsoft/sqlserver/jdbc/SQLServerDriver.java 57.69% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2868      +/-   ##
============================================
- Coverage     59.23%   59.20%   -0.04%     
- Complexity     4797     4809      +12     
============================================
  Files           151      151              
  Lines         34781    34825      +44     
  Branches       5829     5834       +5     
============================================
+ Hits          20604    20618      +14     
- Misses        11380    11416      +36     
+ Partials       2797     2791       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@muskan124947
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

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 extends the Microsoft SQL Server JDBC driver’s vector feature support to introduce an explicit vectorTypeSupport version model, including v2 (float32 + float16) and client–server negotiation of supported vector versions.

Changes:

  • Introduces a VectorTypeSupport enum and TDS constants for vector feature extension, wiring them into connection properties and feature negotiation during login.
  • Adds client–server vector version negotiation in SQLServerConnection, with a tracked negotiatedVectorVersion and a getter, and updates resource strings and public APIs (ISQLServerConnection, ISQLServerDataSource, pool proxy) to document v2 support.
  • Updates tests and helpers (e.g., VectorTest and property metadata) to recognize "v2" as a valid vectorTypeSupport value and to support float16-specific behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java Adds VectorTypeSupport enum mapping logical values to TDS versions, updates the vectorTypeSupport driver property default, and exposes the allowed values via SQLServerDriverPropertyInfo for configuration tooling.
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java Reworks vector-type configuration to use VectorTypeSupport, adds negotiatedVectorVersion state, integrates vector version negotiation into feature extension ACK handling, and exposes getNegotiatedVectorVersion().
src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java Extends TDS constants for vector support to define explicit v1 and v2 values and updates the maximum supported version to 2.
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java Updates resource strings for vectorTypeSupport to document the new valid value "v2" and keep error messages aligned with the property’s semantics.
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java Updates the setVectorTypeSupport / getVectorTypeSupport Javadoc to describe v2, aligning the public connection interface with the extended vector support options.
src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java Mirrors the vectorTypeSupport documentation updates on the DataSource API to include v2 and clarify behavior.
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java Propagates and documents the extended vectorTypeSupport property through the pooled connection proxy.
src/test/java/com/microsoft/sqlserver/jdbc/datatypes/VectorTest.java Extends the test helper connection factory to accept "v2" as a valid vectorTypeSupport value while otherwise preserving existing vector behavior tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7204 to +7218
private byte negotiateVectorVersion(VectorTypeSupport clientVectorSupportEnum, byte serverVersion) {

// If server doesn't support vectors, negotiation is off
if (serverVersion == TDS.VECTORSUPPORT_NOT_SUPPORTED) {
return TDS.VECTORSUPPORT_NOT_SUPPORTED;
}

if (clientVectorSupportEnum == VectorTypeSupport.OFF) {
return TDS.VECTORSUPPORT_NOT_SUPPORTED;
}

byte clientMaxVersion = clientVectorSupportEnum.getTdsValue();

// Negotiate using the minimum supported version
return (byte) Math.min(clientMaxVersion, serverVersion);
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

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

The new negotiateVectorVersion logic introduces non-trivial behavior (e.g., handling client OFF vs. server NOT_SUPPORTED, client V2 vs. server V1, etc.), but there do not appear to be tests that directly validate these negotiation outcomes or the negotiatedVectorVersion field. Given that other SQLServerConnection behaviors are covered by tests (for example, see RequestBoundaryMethodsTest.setConnectionFields / compareValuesAgainstConnection), consider adding targeted tests that exercise this negotiation for the key combinations of client and server versions to guard against regressions.

Copilot uses AI. Check for mistakes.
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.

2 participants