Skip to content

fix(quantizers): use the field names the server actually reads - #612

Open
dudanogueira wants to merge 3 commits into
mainfrom
fix/quantizer-field-names
Open

dudanogueira wants to merge 3 commits into
mainfrom
fix/quantizer-field-names

Conversation

@dudanogueira

@dudanogueira dudanogueira commented Aug 25, 2026 •

Copy link
Copy Markdown

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 null on read.

Fix

Was Now Records
rescore_limit rescoreLimit BQ, SQ, RQ
training_limit trainingLimit PQ, SQ
bit_compression bitCompression PQ
encoder_type, encoder_distribution encoder: {type, distribution} PQ
  • PQ.encoderType() / PQ.encoderDistribution() and the builder are unchanged.
  • JSONTest rows updated; CollectionsITest.test_quantizerSettingsRoundTrip checks the values survive a real server round trip.

Breaking changes

PQ's canonical constructor takes a single Encoder encoder instead of encoderType, encoderDistribution. Only code calling new PQ(...) directly or destructuring it is affected.

Closes #611

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

@orca-security-eu orca-security-eu Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copilot AI left a comment

Copy link
Copy Markdown

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 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.

@dudanogueira

Copy link
Copy Markdown
Author

On the suggestion of a delegating @Deprecated constructor for PQ — the break is real and is already disclosed in ## Breaking changes above, but I have deliberately not added the compatibility overload, to stay consistent with the rest of this batch.

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. PQ follows it: encoderType() and encoderDistribution() survive as derived accessors over the new nested Encoder, so the flat way of reading and setting them still works, and only code calling new PQ(...) positionally or destructuring it in a record pattern has to change.

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.

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.

v6: quantizer settings use snake_case names the server never reads

2 participants