From 90de37e60afad29e021e5615dcd2ffb9fb15b3f5 Mon Sep 17 00:00:00 2001 From: Xianhui Lin <35839735+JsDove@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:32:45 +0800 Subject: [PATCH] enhance: field stringtype maxlength raise to 1M (#38592) enhance: field stringtype maxlength raise to 1M issue: https://github.com/milvus-io/milvus/issues/37436 Signed-off-by: Xianhui.Lin --- internal/proxy/task.go | 2 +- internal/proxy/util.go | 4 ++-- tests/go_client/common/consts.go | 2 +- tests/go_client/testcases/collection_test.go | 4 ++-- tests/python_client/testcases/test_collection.py | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/proxy/task.go b/internal/proxy/task.go index e6488aa3627ff..ed8f6f77af099 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -1252,7 +1252,7 @@ func (t *alterCollectionFieldTask) PreExecute(ctx context.Context) error { } if value > defaultMaxVarCharLength { - return merr.WrapErrParameterInvalid("%s exceeds the maximum allowed value 65535", prop.Value) + return merr.WrapErrParameterInvalid("%s exceeds the maximum allowed value 1048576", prop.Value) } } } diff --git a/internal/proxy/util.go b/internal/proxy/util.go index a159e2d950777..76b477400fea4 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -64,7 +64,7 @@ const ( // enableMultipleVectorFields indicates whether to enable multiple vector fields. enableMultipleVectorFields = true - defaultMaxVarCharLength = 65535 + defaultMaxVarCharLength = 1048576 defaultMaxArrayCapacity = 4096 @@ -365,7 +365,7 @@ func validateMaxLengthPerRow(collectionName string, field *schemapb.FieldSchema) return err } if maxLengthPerRow > defaultMaxVarCharLength || maxLengthPerRow <= 0 { - return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be in (0, 65535]") + return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be in (0, 1048576]") } exist = true } diff --git a/tests/go_client/common/consts.go b/tests/go_client/common/consts.go index 91a6df94fb219..5162b0917dcf5 100644 --- a/tests/go_client/common/consts.go +++ b/tests/go_client/common/consts.go @@ -57,7 +57,7 @@ const ( DefaultRgName = "__default_resource_group" DefaultDb = "default" MaxDim = 32768 - MaxLength = int64(65535) + MaxLength = int64(1048576) MaxCollectionNameLen = 255 DefaultRgCapacity = 1000000 RetentionDuration = 40 // common.retentionDuration diff --git a/tests/go_client/testcases/collection_test.go b/tests/go_client/testcases/collection_test.go index e5e009bb2b7a9..248206c56e269 100644 --- a/tests/go_client/testcases/collection_test.go +++ b/tests/go_client/testcases/collection_test.go @@ -836,7 +836,7 @@ func TestCreateVarcharArrayInvalidLength(t *testing.T) { for _, invalidLength := range []int64{-1, 0, common.MaxLength + 1} { arrayVarcharField.WithMaxLength(invalidLength) err := mc.CreateCollection(ctx, client.NewCreateCollectionOption(collName, schema)) - common.CheckErr(t, err, false, "the maximum length specified for a VarChar should be in (0, 65535]") + common.CheckErr(t, err, false, "the maximum length specified for a VarChar should be in (0, 1048576]") } } @@ -858,7 +858,7 @@ func TestCreateVarcharInvalidLength(t *testing.T) { for _, invalidLength := range []int64{-1, 0, common.MaxLength + 1} { varcharField.WithMaxLength(invalidLength) err := mc.CreateCollection(ctx, client.NewCreateCollectionOption(collName, schema)) - common.CheckErr(t, err, false, "the maximum length specified for a VarChar should be in (0, 65535]") + common.CheckErr(t, err, false, "the maximum length specified for a VarChar should be in (0, 1048576]") } } diff --git a/tests/python_client/testcases/test_collection.py b/tests/python_client/testcases/test_collection.py index a40949c922d81..5cf191ee55f74 100644 --- a/tests/python_client/testcases/test_collection.py +++ b/tests/python_client/testcases/test_collection.py @@ -3875,10 +3875,10 @@ def test_collection_string_field_with_exceed_max_len(self): c_name = cf.gen_unique_str(prefix) int_field = cf.gen_int64_field(is_primary=True) vec_field = cf.gen_float_vec_field() - max_length = 100000 + max_length = 1048576 + 1 string_field = cf.gen_string_field(max_length=max_length) schema = cf.gen_collection_schema([int_field, string_field, vec_field]) - error = {ct.err_code: 65535, ct.err_msg: "the maximum length specified for a VarChar should be in (0, 65535]"} + error = {ct.err_code: 1048576, ct.err_msg: "the maximum length specified for a VarChar should be in (0, 1048576]"} self.collection_wrap.init_collection(name=c_name, schema=schema, check_task=CheckTasks.err_res, check_items=error) @@ -4117,7 +4117,7 @@ def test_collection_string_array_max_length_invalid(self, max_length): self.init_collection_wrap(schema=array_schema, check_task=CheckTasks.err_res, check_items={ct.err_code: 65535, ct.err_msg: "the maximum length specified for a VarChar " - "should be in (0, 65535]"}) + "should be in (0, 1048576]"}) @pytest.mark.tags(CaseLabel.L2) def test_collection_array_field_all_datatype(self):