From 894c203f279322279e11d681dee9f06f47d76bf8 Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Wed, 18 Dec 2024 15:04:45 +0800 Subject: [PATCH] enhance: allow hyphen in partition name (#38494) Signed-off-by: sunby --- internal/proxy/util.go | 2 +- tests/go_client/common/utils.go | 1 - .../milvus_client/test_milvus_client_insert.py | 4 ++-- .../milvus_client/test_milvus_client_partition.py | 10 +++++----- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/internal/proxy/util.go b/internal/proxy/util.go index 92ae381095314..a159e2d950777 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -266,7 +266,7 @@ func validatePartitionTag(partitionTag string, strictCheck bool) error { tagSize := len(partitionTag) for i := 1; i < tagSize; i++ { c := partitionTag[i] - if c != '_' && !isAlpha(c) && !isNumber(c) { + if c != '_' && !isAlpha(c) && !isNumber(c) && c != '-' { msg := invalidMsg + "Partition name can only contain numbers, letters and underscores." return errors.New(msg) } diff --git a/tests/go_client/common/utils.go b/tests/go_client/common/utils.go index 3090857855262..7b671b0b8c377 100644 --- a/tests/go_client/common/utils.go +++ b/tests/go_client/common/utils.go @@ -58,7 +58,6 @@ func GenInvalidNames() []string { invalidNames := []string{ "", " ", - "12-s", "(mn)", "中文", "%$#", diff --git a/tests/python_client/milvus_client/test_milvus_client_insert.py b/tests/python_client/milvus_client/test_milvus_client_insert.py index ce93aba311a93..c42d68d16dbe4 100644 --- a/tests/python_client/milvus_client/test_milvus_client_insert.py +++ b/tests/python_client/milvus_client/test_milvus_client_insert.py @@ -268,7 +268,7 @@ def test_milvus_client_insert_not_matched_data(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " "]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#", " "]) def test_milvus_client_insert_invalid_partition_name(self, partition_name): """ target: test milvus client: insert extra field than schema @@ -739,7 +739,7 @@ def test_milvus_client_upsert_not_matched_data(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#", " "]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#", " "]) def test_milvus_client_upsert_invalid_partition_name(self, partition_name): """ target: test milvus client: insert extra field than schema diff --git a/tests/python_client/milvus_client/test_milvus_client_partition.py b/tests/python_client/milvus_client/test_milvus_client_partition.py index 21cc32dc5c0ec..c58bf6e3a878e 100644 --- a/tests/python_client/milvus_client/test_milvus_client_partition.py +++ b/tests/python_client/milvus_client/test_milvus_client_partition.py @@ -114,7 +114,7 @@ def test_milvus_client_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -384,7 +384,7 @@ def test_milvus_client_drop_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_drop_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -483,7 +483,7 @@ def test_milvus_client_release_partition_not_exist_collection_name(self): @pytest.mark.tags(CaseLabel.L1) @pytest.mark.xfail(reason="pymilvus issue 1896") - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_release_partition_invalid_partition_name(self, partition_name): """ target: test release partition -- invalid partition name value @@ -809,7 +809,7 @@ def test_milvus_client_has_partition_not_exist_collection_name(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("partition_name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("partition_name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_has_partition_invalid_partition_name(self, partition_name): """ target: test fast create collection normal case @@ -930,7 +930,7 @@ def test_milvus_client_load_partitions_collection_name_over_max_length(self): check_task=CheckTasks.err_res, check_items=error) @pytest.mark.tags(CaseLabel.L1) - @pytest.mark.parametrize("name", ["12-s", "12 s", "(mn)", "中文", "%$#"]) + @pytest.mark.parametrize("name", ["12 s", "(mn)", "中文", "%$#"]) def test_milvus_client_load_partitions_invalid_partition_name(self, name): """ target: test fast create collection normal case