[VECTOR_FLOAT16] Add bulk copy support for vector float16 and added tests#2898
Conversation
# Conflicts: # src/test/java/com/microsoft/sqlserver/jdbc/datatypes/vector/VectorFloat16Test.java # src/test/java/com/microsoft/sqlserver/jdbc/datatypes/vector/VectorFloat32Test.java
There was a problem hiding this comment.
Pull request overview
This PR adds bulk copy support for the VECTOR FLOAT16 data type in the JDBC driver. It extends the existing FLOAT32 vector bulk copy support to also handle FLOAT16 vectors, adding version-checking logic to enforce that FLOAT16 is only available when the server negotiates vector version 2 (v2). The PR also reorganizes vector bulk copy tests from scattered locations into a dedicated abstract base class hierarchy.
Changes:
- Production code in
SQLServerBulkCopy.javaadds version checks that reject FLOAT16 vectors on v1 connections and throw errors when vector support is entirely disabled SQLServerBulkCSVFileRecord.javafixes a bug where the scale passed togetVectorDimensionType()was bytes-per-dimension (4/2) but the method expected a TDS scale byte (0/1)- Test code is reorganized: vector bulk copy tests moved from
BatchExecutionWithBulkCopyTest,BulkCopyCSVTest, andDatabaseMetaDataTestinto a new abstractVectorBulkCopyTestbase class withVectorFloat32BulkCopyTestandVectorFloat16BulkCopyTestconcrete subclasses
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
SQLServerBulkCopy.java |
Adds getNegotiatedVectorVersion() checks in writeTypeInfo and getDestTypeFromSrcType to reject unsupported vector types; adds FLOAT16 column definition |
SQLServerBulkCSVFileRecord.java |
Fixes bug: converts bytes-per-dimension scale to TDS scale byte before calling getVectorDimensionType() |
VectorBulkCopyTest.java |
New abstract base class with all shared bulk copy test logic and inner helper implementations |
VectorFloat32BulkCopyTest.java |
FLOAT32-specific test class; adds tests for FLOAT16-on-v1-connection error cases |
VectorFloat16BulkCopyTest.java |
FLOAT16-specific test class; delegates all tests to base class |
BatchExecutionWithBulkCopyTest.java |
Removes FLOAT32-only vector bulk copy tests (moved to new test hierarchy) |
BulkCopyCSVTest.java |
Removes FLOAT32-only vector CSV bulk copy tests (moved to new test hierarchy) |
DatabaseMetaDataTest.java |
Removes FLOAT32-only vector metadata test (presumably moved elsewhere or removed as duplicate) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2898 +/- ##
=========================================
Coverage 60.64% 60.65%
- Complexity 4913 4921 +8
=========================================
Files 151 151
Lines 34986 35000 +14
Branches 5849 5854 +5
=========================================
+ Hits 21218 21229 +11
- Misses 10927 10937 +10
+ Partials 2841 2834 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…lkcopy/VectorBulkCopyTest.java Co-authored-by: Copilot <[email protected]>
Description
Building on the existing VECTOR(FLOAT16) support in [VECTOR_FLOAT16] Add support for vector float16 data type
#2899, this PR adds full end-to-end support for the bulk copy operations (bulk inserts with useBulkCopyForBatchInsert, table-to-table bulk copies, CSV-to-table bulk copies).
Below are some example scenarios:
vector.csv
Note: Currently, tests tagged with vectorFloat16Test are excluded from ADO runs and Github checks. These will be enabled post the official build rollout.