Skip to content

Commit

Permalink
field stringtype maxlength raise to 1M
Browse files Browse the repository at this point in the history
Signed-off-by: Xianhui.Lin <[email protected]>

fix invalidstringfiledtype ut

Signed-off-by: Xianhui.Lin <[email protected]>

fix invalidstringfiledtype ut

Signed-off-by: Xianhui.Lin <[email protected]>
  • Loading branch information
JsDove committed Dec 20, 2024
1 parent 8fcb33c commit 81e193d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion internal/proxy/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/proxy/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const (
// enableMultipleVectorFields indicates whether to enable multiple vector fields.
enableMultipleVectorFields = true

defaultMaxVarCharLength = 65535
defaultMaxVarCharLength = 1048576

defaultMaxArrayCapacity = 4096

Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions tests/go_client/testcases/collection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
}
}

Expand All @@ -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]")
}
}

Expand Down
6 changes: 3 additions & 3 deletions tests/python_client/testcases/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: 65535, 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)

Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 81e193d

Please sign in to comment.