-
Notifications
You must be signed in to change notification settings - Fork 317
API enhancements for vector datatype #3468
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
API enhancements for vector datatype #3468
Conversation
There was a problem hiding this 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 enhances the vector datatype API by replacing the length‐based constructor with a clearer factory, removing the public Size property (now inferred), converting SqlVector<T> to a readonly struct, and updating the SQL parameter handling and tests to match.
- Refactored
SqlVector<T>: made it areadonly struct, dropped the publicSizeproperty, and addedCreateNull(int length). - Updated
SqlParameterto ignoreSizefor vector types and adjustedPreparelogic. - Revised unit and manual tests to use
CreateNull, removed directSizeassertions, and updated documentation and ref surfaces.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlVector.cs | Converted SqlVector<T> to struct, added CreateNull, removed Size property |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlParameter.cs | Skip applying Size for vector parameters and update Prepare check |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDataReader.cs | Simplified vector‐to‐string conversion logic |
| src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlBuffer.cs | Use CreateNull when returning a null vector |
| src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlTypes/SqlVectorTest.cs | Updated tests to use CreateNull and check Size via ISqlVector |
| src/Microsoft.Data.SqlClient/tests/ManualTests/SQL/VectorTest/NativeVectorFloat32Tests.cs | Removed sizeInbytes, adapted test data and validation |
| src/Microsoft.Data.SqlClient/net*/ref/Microsoft.Data.SqlClient.cs | Updated API surface: SqlVector<T> now readonly struct, added CreateNull |
| doc/snippets/Microsoft.Data.SqlClient/SqlCommand.xml | Clarified in docs that Size is ignored for vectors |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlDataReader.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlTypes/SqlVector.cs
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3468 +/- ##
==========================================
- Coverage 68.86% 0 -68.87%
==========================================
Files 280 0 -280
Lines 62417 0 -62417
==========================================
- Hits 42982 0 -42982
+ Misses 19435 0 -19435
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
paulmedynski
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor comments.
Description
In case specified, it will be ignored.
Issues
Incorporating suggestions from #3382
Testing
Modified existing testcases for above changes.
Guidelines
Please review the contribution guidelines before submitting a pull request: