Repository navigation
fix(quantizers): use the field names the server actually reads - #612
dudanogueira wants to merge 3 commits into
Conversation
Weaviate parses quantizer settings out of the config map by exact key,
and returns them under the same names. The client used snake_case for
half of them, so rescoreLimit, trainingLimit and bitCompression were
dropped on write and came back null on read -- on every index type. A
user who set a rescore limit never set one.
rescore_limit -> rescoreLimit (BQ, SQ, RQ)
training_limit -> trainingLimit (PQ, SQ)
bit_compression -> bitCompression (PQ)
PQ's encoder needed a shape change rather than a rename: the server
nests it as encoder: {type, distribution} while the client had two flat
components. PQ.encoderType() and PQ.encoderDistribution() are kept as
derived accessors and the builder is unchanged, so only the canonical
constructor differs.
No alternate names: the snake_case spellings were never valid on the
wire, so no stored config uses them.
Closes #611
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmY5dAGWCccWDoqkKNC2JU
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
Pull request overview
This PR fixes Weaviate quantizer JSON field naming/shape mismatches so quantization settings are correctly sent to (and read back from) the server, instead of being silently dropped due to case/shape differences.
Changes:
- Renames quantizer JSON keys from snake_case to the server’s exact camelCase keys for RQ/BQ/SQ/PQ fields.
- Updates PQ’s encoder representation to match the server’s nested
encoder: {type, distribution}object. - Strengthens test coverage by updating JSON round-trip expectations and adding an integration round-trip assertion for
rq.rescoreLimit.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/io/weaviate/client6/v1/api/collections/quantizers/SQ.java | Switch SQ JSON keys to server-read camelCase names. |
| src/main/java/io/weaviate/client6/v1/api/collections/quantizers/RQ.java | Switch RQ rescoreLimit JSON key to server-read camelCase. |
| src/main/java/io/weaviate/client6/v1/api/collections/quantizers/BQ.java | Switch BQ rescoreLimit JSON key to server-read camelCase. |
| src/main/java/io/weaviate/client6/v1/api/collections/quantizers/PQ.java | Align PQ with server by nesting encoder settings and fixing key names. |
| src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java | Update serialization/deserialization golden JSON to match server spelling/shape. |
| src/it/java/io/weaviate/integration/CollectionsITest.java | Add IT that validates quantizer settings survive a server round trip. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
On the suggestion of a delegating The convention across #608, #609, #610, #613 and #616 is to state precisely what breaks and keep the accessors and the builder working, rather than to deprecate. A deprecated overload would also carry a cost specific to this fix: the old parameter list is exactly the shape that produced the wrong wire format, so keeping it compiling would keep a path that silently sends settings the server never reads. Happy to add one if you would rather have it — it is a small change and I will follow whichever way you want this to go across the batch. |
Problem
The server reads quantizer settings by exact camelCase key. The client sent several in snake_case, and PQ's encoder as two flat keys, so those settings were dropped on write and came back
nullon read.Fix
rescore_limitrescoreLimittraining_limittrainingLimitbit_compressionbitCompressionencoder_type,encoder_distributionencoder: {type, distribution}PQ.encoderType()/PQ.encoderDistribution()and the builder are unchanged.JSONTestrows updated;CollectionsITest.test_quantizerSettingsRoundTripchecks the values survive a real server round trip.Breaking changes
PQ's canonical constructor takes a singleEncoder encoderinstead ofencoderType, encoderDistribution. Only code callingnew PQ(...)directly or destructuring it is affected.Closes #611