anshul98ks123 commented on code in PR #18317:
URL: https://github.com/apache/pinot/pull/18317#discussion_r3200618875
##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/creator/VectorIndexConfig.java:
##########
@@ -150,6 +153,35 @@ public VectorBackendType resolveBackendType() {
return VectorIndexConfigValidator.resolveBackendType(this);
}
+ /**
+ * Curated slim serializer. See {@link IndexConfig#toJsonObject()} for the
rationale.
+ *
+ * <p>Note: {@code @JsonCreator} reads {@code vectorDimension} and {@code
version} as primitive
+ * {@code int}, so a value of {@code 0} is indistinguishable from "absent"
and is therefore
+ * treated as the default and omitted on serialization.
+ */
+ @Override
+ @JsonValue
+ public ObjectNode toJsonObject() {
+ ObjectNode node = super.toJsonObject();
+ if (_vectorIndexType != null) {
+ node.put("vectorIndexType", _vectorIndexType);
+ }
+ if (_vectorDimension != 0) {
+ node.put("vectorDimension", _vectorDimension);
+ }
+ if (_version != 0) {
+ node.put("version", _version);
+ }
+ if (_vectorDistanceFunction != null) {
+ node.put("vectorDistanceFunction", _vectorDistanceFunction.name());
+ }
+ if (_properties != null && !_properties.isEmpty()) {
Review Comment:
Fixed by normalizing to non-null empty map in VectorIndexConfig:
- `VectorIndexConfig(Boolean disabled)` now sets `_properties =
Collections.emptyMap()`
- `@JsonCreator` now does `_properties = properties != null ? properties :
Collections.emptyMap()`
- `setProperties(...)` now also normalizes null -> empty map
- serializer check simplified to `if (!_properties.isEmpty())`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]