Support FunctionChain - #2037
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: yhmo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
Pull request overview
Adds client-side support for “FunctionChain” in v2 search requests, enabling users to attach a function-chain pipeline (map/sort/limit) to ordinary search and serialize it into the gRPC SearchRequest.
Changes:
- Introduces new request-model types for function chains (
FunctionChain, ops/expr/args/stage, and typedFunctionParamValue). - Extends
SearchReq+VectorUtils.ConvertToGrpcSearchRequestto carry/serializefunctionChains, with validation that it’s mutually exclusive withranker/functionScoreand that stage is specified. - Adds unit tests covering serialization and basic validation rejection cases.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java | Adds tests for function-chain search serialization and invalid combinations. |
| sdk-core/src/main/java/io/milvus/v2/utils/VectorUtils.java | Serializes functionChains into gRPC SearchRequest and adds validation. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/SearchReq.java | Adds functionChains field + builder/setters/toString support. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionParamValue.java | Adds typed parameter/literal encoding to gRPC FunctionParamValue. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionChainStage.java | Adds Java enum wrapper for gRPC function-chain stages. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionChainOp.java | Adds operation model (map/sort/limit) and gRPC serialization. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionChainExpr.java | Adds expression model for map ops and gRPC serialization. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionChainArg.java | Adds column/literal argument model and gRPC serialization. |
| sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionChain.java | Adds fluent builder for composing a chain and converting to gRPC. |
Suppressed comments (1)
sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java:553
- This test only asserts that an exception is thrown, but not that it is the intended INVALID_PARAMS validation failure; asserting the error code makes the test less prone to false positives.
Assertions.assertThrows(MilvusClientException.class, () -> client_v2.search(request));
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: yhmo <yihua.mo@zilliz.com>
| * A typed value used as a function-chain parameter or literal argument. | ||
| * | ||
| * <p>Values are converted from ordinary Java objects into the protobuf | ||
| * {@code FunctionParamValue} message: {@code Boolean} -> bool, integral numbers -> int64, |
There was a problem hiding this comment.
sdk-core/src/main/java/io/milvus/v2/service/vector/request/FunctionParamValue.java line:33
Low ---- The class-level Javadoc still lists the supported conversions as Boolean/integral/Float/Double/String/byte[]+ByteString/List/Map, but the latest commit added BigInteger (range-checked to int64), Character (single-char string) and char[] (UTF-8 bytes) to from() without updating this summary. from()'s own Javadoc (lines 84-92) documents the new types, so the class summary and the method Javadoc now disagree about the supported input surface. Please extend the class Javadoc to match, so the public contract is consistent.
No description provided.