From a084eae75a81c19c95ba8af152042960b050a18f Mon Sep 17 00:00:00 2001 From: "Xianhui.Lin" Date: Thu, 19 Dec 2024 16:00:59 +0800 Subject: [PATCH 1/3] remove field stringtype length limit Signed-off-by: Xianhui.Lin modify the message hint Signed-off-by: Xianhui.Lin --- internal/proxy/task.go | 5 +---- internal/proxy/util.go | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/proxy/task.go b/internal/proxy/task.go index e6488aa3627ff..023138ee309d8 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -1246,14 +1246,11 @@ func (t *alterCollectionFieldTask) PreExecute(ctx context.Context) error { if !IsStringType { return merr.WrapErrParameterInvalid(fieldName, "%s can not modify the maxlength for non-string types", schemapb.DataType_name[dataType]) } - value, err := strconv.Atoi(prop.Value) + _, err := strconv.Atoi(prop.Value) if err != nil { return merr.WrapErrParameterInvalid("%s should be an integer, but got %T", prop.Key, prop.Value) } - if value > defaultMaxVarCharLength { - return merr.WrapErrParameterInvalid("%s exceeds the maximum allowed value 65535", prop.Value) - } } } diff --git a/internal/proxy/util.go b/internal/proxy/util.go index a159e2d950777..ead13707f7b9f 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -364,8 +364,8 @@ func validateMaxLengthPerRow(collectionName string, field *schemapb.FieldSchema) if err != nil { return err } - if maxLengthPerRow > defaultMaxVarCharLength || maxLengthPerRow <= 0 { - return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be in (0, 65535]") + if maxLengthPerRow <= 0 { + return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be greater than 0") } exist = true } From 6fa7505171753fc1c6c492bba9c06e9394617a32 Mon Sep 17 00:00:00 2001 From: "Xianhui.Lin" Date: Thu, 19 Dec 2024 19:02:44 +0800 Subject: [PATCH 2/3] Revert "remove field stringtype length limit" This reverts commit a084eae75a81c19c95ba8af152042960b050a18f. --- internal/proxy/task.go | 5 ++++- internal/proxy/util.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/proxy/task.go b/internal/proxy/task.go index 023138ee309d8..e6488aa3627ff 100644 --- a/internal/proxy/task.go +++ b/internal/proxy/task.go @@ -1246,11 +1246,14 @@ func (t *alterCollectionFieldTask) PreExecute(ctx context.Context) error { if !IsStringType { return merr.WrapErrParameterInvalid(fieldName, "%s can not modify the maxlength for non-string types", schemapb.DataType_name[dataType]) } - _, err := strconv.Atoi(prop.Value) + value, err := strconv.Atoi(prop.Value) if err != nil { return merr.WrapErrParameterInvalid("%s should be an integer, but got %T", prop.Key, prop.Value) } + if value > defaultMaxVarCharLength { + return merr.WrapErrParameterInvalid("%s exceeds the maximum allowed value 65535", prop.Value) + } } } diff --git a/internal/proxy/util.go b/internal/proxy/util.go index ead13707f7b9f..a159e2d950777 100644 --- a/internal/proxy/util.go +++ b/internal/proxy/util.go @@ -364,8 +364,8 @@ func validateMaxLengthPerRow(collectionName string, field *schemapb.FieldSchema) if err != nil { return err } - if maxLengthPerRow <= 0 { - return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be greater than 0") + if maxLengthPerRow > defaultMaxVarCharLength || maxLengthPerRow <= 0 { + return merr.WrapErrParameterInvalidMsg("the maximum length specified for a VarChar should be in (0, 65535]") } exist = true } From bd91bf1606a7ac509108b38469a9a44248b38cf9 Mon Sep 17 00:00:00 2001 From: "Xianhui.Lin" Date: Thu, 19 Dec 2024 19:13:30 +0800 Subject: [PATCH 3/3] field stringtype maxlength raise to 1M Signed-off-by: Xianhui.Lin --- internal/proxy/task.go | 2 +- internal/proxy/util.go | 4 ++-- 2 files changed, 3 insertions(+), 3 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 }