Conversation
…ion (#293) The Weaviate gRPC protocol only supports fp32 (SingleFp32/MultiFp32), but ToByteString(this Vector) was serializing the backing data using its native byte width (8 bytes for double, 8 bytes for long, etc.). When a user provided a double[] vector of dimension 1536, the server received 12288 bytes labelled as SingleFp32 and interpreted them as 3072 floats — doubling the dimension with garbled NaN values. The fix converts all non-float numeric types to float32 before byte serialisation in both ToByteString() and ToMultiDimensionalByteString(). The single REST insert path was unaffected (JSON serialisation handles doubles natively); only the gRPC batch path and vector-search path were buggy. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Secrets | View in Orca |
Summary - Weaviate C# Client CoverageSummary
CoverageWeaviate.Client - 60.7%
Weaviate.Client.Analyzers - 91.4%
|
dirkkul
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #293 — batch
InsertManywith non-floatself-provided vectors (e.g.double[]) produced double the expected dimension with NaN values on retrieval.Root cause:
ToByteString(this Vector)inExtensions.csserialised backing data using its native byte width (8 bytes fordouble). The Weaviate gRPC protocol only supportsfp32(SingleFp32/MultiFp32). Sending1536 × 8 = 12288bytes labelled asSingleFp32caused the server to interpret them as3072floats with garbled NaN values.Fix: Convert all non-
floatnumeric vector types tofloat32before byte serialisation in bothToByteString()andToMultiDimensionalByteString(). The single REST insert path is unaffected (JSON serialises doubles natively).Scope: Also fixes the same bug in the vector-search path (
Search.Builders.cs) since it calls the sameToByteString()extension.Changes
src/Weaviate.Client/Extensions.cs—ToByteStringandToMultiDimensionalByteStringnow always emit float32 bytes for all numeric vector typessrc/Weaviate.Client.Tests/Unit/TestVectorData.cs— 5 new unit tests verifying the byte-length contract (N elements × 4 bytes) and value correctnessTest Plan
Expected: 12, Actual: 24)