Skip to content

Support FunctionChain - #2037

Open
yhmo wants to merge 1 commit into
milvus-io:masterfrom
yhmo:mm
Open

Support FunctionChain#2037
yhmo wants to merge 1 commit into
milvus-io:masterfrom
yhmo:mm

Conversation

@yhmo

@yhmo yhmo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI lite review requested due to automatic review settings August 21, 2026 10:31
@sre-ci-robot

Copy link
Copy Markdown

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mergify

mergify Bot commented Aug 21, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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

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 typed FunctionParamValue).
  • Extends SearchReq + VectorUtils.ConvertToGrpcSearchRequest to carry/serialize functionChains, with validation that it’s mutually exclusive with ranker/functionScore and 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.

Comment thread sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java
Comment thread sdk-core/src/main/java/io/milvus/v2/utils/VectorUtils.java Outdated
Comment thread sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java Outdated
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.25210% with 47 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@382eb27). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...vus/v2/service/vector/request/FunctionChainOp.java 80.28% 8 Missing and 6 partials ⚠️
.../v2/service/vector/request/FunctionParamValue.java 82.75% 8 Missing and 2 partials ⚠️
...s/v2/service/vector/request/FunctionChainExpr.java 70.00% 6 Missing and 3 partials ⚠️
...ilvus/v2/service/vector/request/FunctionChain.java 85.29% 4 Missing and 1 partial ⚠️
...us/v2/service/vector/request/FunctionChainArg.java 72.22% 4 Missing and 1 partial ⚠️
...io/milvus/v2/service/vector/request/SearchReq.java 66.66% 2 Missing ⚠️
.../src/main/java/io/milvus/v2/utils/VectorUtils.java 77.77% 0 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2037   +/-   ##
=========================================
  Coverage          ?   66.31%           
  Complexity        ?     4621           
=========================================
  Files             ?      481           
  Lines             ?    27647           
  Branches          ?     2672           
=========================================
  Hits              ?    18335           
  Misses            ?     7912           
  Partials          ?     1400           
Files with missing lines Coverage Δ
.../v2/service/vector/request/FunctionChainStage.java 100.00% <100.00%> (ø)
...io/milvus/v2/service/vector/request/SearchReq.java 72.63% <66.66%> (ø)
.../src/main/java/io/milvus/v2/utils/VectorUtils.java 62.44% <77.77%> (ø)
...ilvus/v2/service/vector/request/FunctionChain.java 85.29% <85.29%> (ø)
...us/v2/service/vector/request/FunctionChainArg.java 72.22% <72.22%> (ø)
...s/v2/service/vector/request/FunctionChainExpr.java 70.00% <70.00%> (ø)
.../v2/service/vector/request/FunctionParamValue.java 82.75% <82.75%> (ø)
...vus/v2/service/vector/request/FunctionChainOp.java 80.28% <80.28%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify Bot added the ci-passed label Aug 21, 2026
Comment thread sdk-core/src/test/java/io/milvus/v2/service/vector/VectorTest.java Outdated
@mergify mergify Bot added the ci-passed label Aug 21, 2026
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} -&gt; bool, integral numbers -&gt; int64,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants