Repository navigation
fix: send the path of PATH_REPLACE field ops - #3902
zhengbuqian wants to merge 1 commit into
Conversation
Prepare._apply_field_ops copied only field_name and op into the request, so a PATH_REPLACE op reached the server without its path and positional partial upsert could not work from pymilvus. Forward the path, add FieldOp.path_replace(path) as the documented way to build the op, and reject a PATH_REPLACE op without a path when the request is prepared. Signed-off-by: Buqian Zheng <zhengbuqian@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zhengbuqian The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3902 +/- ##
=======================================
Coverage 94.73% 94.73%
=======================================
Files 81 81
Lines 17102 17109 +7
=======================================
+ Hits 16201 16208 +7
Misses 901 901 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
XuanYang-cn
left a comment
There was a problem hiding this comment.
One question about the documented Struct child replacement case.
| """Return a PATH_REPLACE op that replaces only the value at ``path``. | ||
|
|
||
| ``path`` is relative to the field: ``"[1]"`` selects one Array or | ||
| Array-of-Struct element, ``"[1][age]"`` one child of a struct element, |
There was a problem hiding this comment.
Could the documented [1][age] case still be blocked by Struct operand serialization?
With a profile StructArray containing age and city, I reproduced this at the PR head through Prepare.row_upsert_param:
data = [{"id": 1, "profile": [{"age": 18}]}]
field_ops = {"profile": FieldOp.path_replace("[1][age]")}Request preparation raises DataNotMatchException with missing required fields: {'city'}, because _validate_and_collect_struct_values still requires every schema child. Supplying city would conflict with the design requirement that a [index][child] operand contain exactly the named child.
This serializer restriction already exists on the base, but the new helper documents this use case. Do you consider this a gap that needs addressing here, with a row-upsert regression test, or is the required Struct operand support intentionally deferred?
|
/hold need to redo this PR after #3882 merge |
Prepare._apply_field_opscopied onlyfield_nameandopof eachFieldPartialUpdateOpinto the insert/upsert request and droppedpath. APATH_REPLACEop therefore reached the server without a path, so positional partial upsert (milvus-io/milvus#53016) could not be used from pymilvus.Changes:
_apply_field_opsforwardspathalong with the field name and op.FieldOp.path_replace(path)factory, the form used in the PATH_REPLACE design (FieldOp.path_replace("[1]"),FieldOp.path_replace("[1][age]")). It rejects an empty or non-string path.normalize_field_opsrejects aPATH_REPLACEop without a path (given as an enum, an int, or a proto message with no path) when the request is prepared, instead of sending it to the server.Tests: new unit tests in
tests/unit/prepare/test_partial_op.pycover the factory, path validation, and that the path reachesrequest.field_ops, both through_apply_field_opsdirectly and throughbatch_upsert_param.tests/unitpasses locally (5498 passed, 1 skipped).