Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: TypeError if consistency_level is passed to Collection.delete #2327

Open
1 task done
ofir-ov opened this issue Nov 6, 2024 · 0 comments
Open
1 task done
Assignees
Labels
kind/bug Something isn't working

Comments

@ofir-ov
Copy link

ofir-ov commented Nov 6, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When I do

my_collection.delete(expr='...', consistency_level='Strong')  # Or any `consistency_level` for that matter

I get the following error:

    @retry_on_rpc_failure()
    def delete(
        self,
        collection_name: str,
        expression: str,
        partition_name: Optional[str] = None,
        timeout: Optional[float] = None,
        **kwargs,
    ):
        check_pass_param(collection_name=collection_name, timeout=timeout)
        try:
>           req = Prepare.delete_request(
                collection_name,
                partition_name,
                expression,
                consistency_level=kwargs.get("consistency_level", 0),
                param_name=kwargs.pop("param_name", None),
                **kwargs,
            )
E           TypeError: pymilvus.client.prepare.Prepare.delete_request() got multiple values for keyword argument 'consistency_level'

/usr/local/lib/python3.12/site-packages/pymilvus/client/grpc_handler.py:597: TypeError

Expected Behavior

To not fail

Steps/Code To Reproduce behavior

All you need to do is pass the consistency_level to the delete method. This bug is directly due to the use of kwargs.get in the function in order to populate a "new" keyword argument called consistency_level in addition to the existing one. It should happen no matter the other circumstances.

Environment details

- Hardware/Softward conditions: (OS: `6.10.0-linuxkit` Docker Desktop on Mac running Linux using the image `python:3.12-slim`, CPU: Apple M2 Pro, Memory: 8GB)
- Method of installation (Docker, or from source): A Docker image, as mentioned above. I'm using LangChain, so technically not calling the collection directly. `langchain-milvus==0.1.4`
- Milvus version (v0.3.1, or v0.4.0): Milvus is running using the Docker image `milvusdb/milvus:v2.4.6`
- Milvus configuration (Settings you made in `server_config.yaml`): Didn't change anything.

Anything else?

The bug is inherit in that call in the code, it basically will never work if consistency_level is provided. It looks like a direct result of this change: cb4cbc6

The solution could be to change the .get to .pop but it's worth making sure it's not going to be a problem with the line

                f = MutationFuture(future, cb, timeout=timeout, **kwargs)

which is also inside this function (I wasn't able to fully follow the logic of MutationFuture).

@ofir-ov ofir-ov added the kind/bug Something isn't working label Nov 6, 2024
@XuanYang-cn XuanYang-cn self-assigned this Nov 6, 2024
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
Also optinal variables default value should always be None.
And empty str is always invalid variable

See also: milvus-io#2327

Signed-off-by: yangxuan <[email protected]>
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 15, 2024
Also optinal variables default value should always be None.
And empty str is always invalid variable

See also: milvus-io#2327
pr: milvus-io#2350

Signed-off-by: yangxuan <[email protected]>
XuanYang-cn added a commit to XuanYang-cn/pymilvus that referenced this issue Nov 18, 2024
Also optinal variables default value should always be None.
And empty str is always invalid variable

See also: milvus-io#2327

Signed-off-by: yangxuan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants