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]: Creating a collection without a vector field was successful #33199

Closed
1 task done
ThreadDao opened this issue May 20, 2024 · 4 comments
Closed
1 task done

[Bug]: Creating a collection without a vector field was successful #33199

ThreadDao opened this issue May 20, 2024 · 4 comments
Assignees
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Milestone

Comments

@ThreadDao
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- Milvus version: Creating a table without a primary key column was successful
- Deployment mode(standalone or cluster): standalone
- MQ type(rocksmq, pulsar or kafka):    
- SDK version(e.g. pymilvus v2.0.0rc2): go-sdk v2
- OS(Ubuntu or CentOS): 
- CPU/Memory: 
- GPU: 
- Others:

Current Behavior

create collection without vector field succ:

func TestCreateCollectionMissingField(t *testing.T) {
	ctx := createContext(t, time.Second*common.DefaultTimeout)
	mc := createDefaultMilvusClient(ctx, t)

	type invalidFieldsStruct struct {
		fields []*entity.Field
		errMsg string
	}
	pkField := entity.NewField().WithName(common.DefaultInt64FieldName).WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)
	pkField2 := entity.NewField().WithName("pk").WithDataType(entity.FieldTypeInt64).WithIsPrimaryKey(true)
	varcharField := entity.NewField().WithName(common.DefaultVarcharFieldName).WithDataType(entity.FieldTypeVarChar)
	stringField := entity.NewField().WithName("str").WithDataType(entity.FieldTypeString)
	vecField := entity.NewField().WithName(common.DefaultFloatVecFieldName).WithDataType(entity.FieldTypeFloatVector).WithDim(common.DefaultDim)
	noneField := entity.NewField().WithName("none").WithDataType(entity.FieldTypeNone)
	invalidFields := []invalidFieldsStruct{
		{fields: []*entity.Field{pkField}, errMsg: "vector field not set"},
		{fields: []*entity.Field{vecField}, errMsg: "primary key is not specified"},
		{fields: []*entity.Field{pkField, pkField2, vecField}, errMsg: "there are more than one primary key"},
		{fields: []*entity.Field{pkField, vecField, noneField}, errMsg: "data type None is not valid"},
		{fields: []*entity.Field{pkField, vecField, stringField}, errMsg: "string data type not supported yet, please use VarChar type instead"},
		{fields: []*entity.Field{pkField, vecField, varcharField}, errMsg: "type param(max_length) should be specified for varChar field"},
	}

	collName := common.GenRandomString(prefix, 6)
	for _, invalidField := range invalidFields {
		schema := entity.NewSchema().WithName(collName)
		for _, field := range invalidField.fields {
			schema.WithField(field)
		}
		collOpt := clientv2.NewCreateCollectionOption(collName, schema)
		err := mc.CreateCollection(ctx, collOpt)
		common.CheckErr(t, err, false, invalidField.errMsg)
	}
}

Expected Behavior

error

Steps To Reproduce

No response

Milvus Log

No response

Anything else?

No response

@ThreadDao ThreadDao added kind/bug Issues or changes related a bug needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 20, 2024
@ThreadDao ThreadDao added this to the 2.4.2 milestone May 20, 2024
@yanliang567
Copy link
Contributor

yanliang567 commented May 21, 2024

/assign @congqixia
it seems that it is only checked in pymilvus:

def check_schema(schema: CollectionSchema):
   ...
    if len(vector_fields) < 1:
        raise SchemaNotReadyException(message=ExceptionsMessage.NoVector)

/unassign

@yanliang567 yanliang567 added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 21, 2024
@ThreadDao
Copy link
Contributor Author

/assign @congqixia it seems that it is only checked in pymilvus:

def check_schema(schema: CollectionSchema):
   ...
    if len(vector_fields) < 1:
        raise SchemaNotReadyException(message=ExceptionsMessage.NoVector)

/unassign

Previously it was checked on the SDK side. Maybe checking in proxy is better.

congqixia added a commit to congqixia/milvus that referenced this issue May 21, 2024
Related to milvus-io#33199

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
sre-ci-robot pushed a commit that referenced this issue May 21, 2024
Related to #33199

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
congqixia added a commit to congqixia/milvus that referenced this issue May 21, 2024
Related to milvus-io#33199

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
@congqixia
Copy link
Contributor

patch merged for master, could you please verify?
/assign @ThreadDao

sre-ci-robot pushed a commit that referenced this issue May 21, 2024
Cherry-pick from master
pr: #33211
Related to #33199

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
@yanliang567 yanliang567 modified the milestones: 2.4.2, 2.4.3, 2.4.4 May 24, 2024
@ThreadDao
Copy link
Contributor Author

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issues or changes related a bug triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants