mirror of https://github.com/milvus-io/milvus.git
Fix issue-6143 (#6145)
* Fix issue-6143 Signed-off-by: kun yu <kun.yu@zilliz.com> * Return error when output_fields contains vector field Signed-off-by: kun yu <kun.yu@zilliz.com> * Fix when output_fields contain primarykey Signed-off-by: kun yu <kun.yu@zilliz.com> * Add primarykey Signed-off-by: kun yu <kun.yu@zilliz.com>pull/6158/head
parent
f973456c10
commit
effcbc7cb3
|
@ -2037,19 +2037,31 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
rt.OutputFields = rt.retrieve.OutputFields
|
||||
for _, reqField := range rt.retrieve.OutputFields {
|
||||
findField := false
|
||||
addPrimaryKey := false
|
||||
for _, field := range schema.Fields {
|
||||
if reqField == field.Name {
|
||||
if field.DataType != schemapb.DataType_FloatVector && field.DataType != schemapb.DataType_BinaryVector {
|
||||
rt.OutputFields = append(rt.OutputFields, reqField)
|
||||
if field.DataType == schemapb.DataType_FloatVector || field.DataType == schemapb.DataType_BinaryVector {
|
||||
errMsg := "Query does not support vector field currently"
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
} else {
|
||||
if field.IsPrimaryKey {
|
||||
addPrimaryKey = true
|
||||
}
|
||||
findField = true
|
||||
rt.OutputFields = append(rt.OutputFields, reqField)
|
||||
} else {
|
||||
if field.IsPrimaryKey && !addPrimaryKey {
|
||||
rt.OutputFields = append(rt.OutputFields, field.Name)
|
||||
addPrimaryKey = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if !findField {
|
||||
errMsg := "Field " + reqField + " not exist"
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue