Skip to content

fix: close Java-vs-pymilvus parity gaps and harden V2 APIs - #2102

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

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

Conversation

@yhmo

@yhmo yhmo commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Close the low-risk, high-value gaps found in the Java-vs-PyMilvus parity audit, plus docs/examples.

Hardening fixes

  • getPartitionStats: no longer throws NoSuchElementException when the server omits row_count; numOfEntities falls back to 0L (matching getCollectionStats).
  • delete: raises a clear INVALID_PARAMS error instead of an NPE when neither filter nor ids is provided; drop field now requires exactly one of fieldName/fieldId.
  • compact: now places collection_name on the wire (ManualCompactionRequest), matching pymilvus.
  • getLoadStateV2: returns LoadStateNotExist instead of throwing when the collection does not exist; the legacy Boolean getLoadState keeps throwing since false would mislead as "not loaded". For a non-existent partition the proxy returns a partition-not-found error status, so getLoadStateV2 still throws there, matching pymilvus.

Deprecations (pymilvus parity)

  • addCollectionFunction / dropCollectionFunction (and their request classes) are now @Deprecated, replaced by addFunctionField / dropFunctionField.

Missing / partial API parity

  • listCompactionTasks: new API listing all retained compaction tasks of a collection (closes the last missing MilvusClientV2 interface); bumps the milvus-proto submodule to expose collection_name on GetCompactionPlansRequest.
  • describeRole: GrantInfo.roleName is now populated per grant.
  • alterCollectionFunction: adds an explicit functionName member (falls back to Function.getName()).
  • getCompactionState / getCompactionPlans: reject a null compaction ID with a clear INVALID_PARAMS error.
  • createResourceGroup: accepts a null config (server default); updateResourceGroups: accepts an empty config map.

Docs / examples

  • V2 examples for index, alias, partition, database and analyzer APIs.
  • AddFieldExample now demonstrates alterCollectionField (e.g. changing max_length).

Tests: mvn -pl sdk-core -o -Pintegration test (2528 unit + integration tests) passes.

Copilot AI lite review requested due to automatic review settings September 23, 2026 03:43

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 Sep 23, 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

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 70.00000% with 24 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@6e788c6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ilvus/v2/service/collection/CollectionService.java 33.33% 8 Missing and 2 partials ⚠️
...ervice/utility/request/ListCompactionTasksReq.java 61.11% 7 Missing ⚠️
...v2/service/resourcegroup/ResourceGroupService.java 66.66% 2 Missing and 1 partial ⚠️
...collection/request/AlterCollectionFunctionReq.java 71.42% 2 Missing ⚠️
...a/io/milvus/v2/service/utility/UtilityService.java 92.30% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2102   +/-   ##
=========================================
  Coverage          ?   80.86%           
=========================================
  Files             ?      490           
  Lines             ?    30093           
  Branches          ?     3122           
=========================================
  Hits              ?    24334           
  Misses            ?     4447           
  Partials          ?     1312           
Files with missing lines Coverage Δ
.../main/java/io/milvus/v2/client/MilvusClientV2.java 74.30% <100.00%> (ø)
...e/collection/request/AddCollectionFunctionReq.java 100.00% <ø> (ø)
.../collection/request/DropCollectionFunctionReq.java 100.00% <ø> (ø)
.../milvus/v2/service/partition/PartitionService.java 88.97% <100.00%> (ø)
...in/java/io/milvus/v2/service/rbac/RBACService.java 98.84% <100.00%> (ø)
...ava/io/milvus/v2/service/vector/VectorService.java 89.92% <100.00%> (ø)
...collection/request/AlterCollectionFunctionReq.java 93.75% <71.42%> (ø)
...a/io/milvus/v2/service/utility/UtilityService.java 94.10% <92.30%> (ø)
...v2/service/resourcegroup/ResourceGroupService.java 92.53% <66.66%> (ø)
...ervice/utility/request/ListCompactionTasksReq.java 61.11% <61.11%> (ø)
... and 1 more
🚀 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 Sep 23, 2026
Comment thread sdk-core/src/main/java/io/milvus/v2/service/partition/PartitionService.java Outdated
@mergify mergify Bot added ci-passed and removed ci-passed labels Sep 23, 2026
@yhmo
yhmo force-pushed the mm branch 2 times, most recently from 144e214 to 58a64b5 Compare September 24, 2026 04:05
@mergify mergify Bot added the ci-passed label Sep 24, 2026
@mergify mergify Bot added ci-passed and removed ci-passed labels Sep 24, 2026
@mergify mergify Bot added ci-passed and removed ci-passed labels Sep 24, 2026
@mergify mergify Bot removed the ci-passed label Sep 24, 2026
@yhmo yhmo changed the title fix: harden getPartitionStats, delete, compact and getLoadStateV2 fix: close Java-vs-pymilvus parity gaps and harden V2 APIs Sep 24, 2026
Comment thread sdk-core/src/main/java/io/milvus/v2/client/MilvusClientV2.java
Comment thread examples/src/main/java/io/milvus/v2/AliasExample.java
- getPartitionStats: fall back to 0L for numOfEntities when row_count is absent, matching getCollectionStats
- delete: raise INVALID_PARAMS instead of NPE when neither filter nor ids is provided; dropCollectionField requires exactly one of fieldName/fieldId
- compact: send collection_name on the wire (ManualCompactionRequest), matching pymilvus
- getLoadStateV2: return LoadStateNotExist when the collection does not exist; the legacy Boolean getLoadState keeps throwing
- deprecate addCollectionFunction and dropCollectionFunction; use addFunctionField and dropFunctionField instead (pymilvus parity)
- docs: add V2 examples for index, alias, partition, database and analyzer APIs
- examples: demonstrate alterCollectionField on a newly added field
- pymilvus parity: allow null config in createResourceGroup and empty map in updateResourceGroups, guard null compaction IDs in getCompactionState/getCompactionPlans, populate GrantInfo.roleName in describeRole, add functionName member to alterCollectionFunction
- add listCompactionTasks API (closes the last missing pymilvus interface) and bump milvus-proto submodule to expose collection_name in GetCompactionPlansRequest
- ci: compile the examples module (install sdk-bulkwriter first) so new examples are verified

Signed-off-by: yhmo <yihua.mo@zilliz.com>

This branch has not been deployed

No deployments
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