mirror of https://github.com/milvus-io/milvus.git
Add primaryKey to output fields (#6094)
Signed-off-by: fishpenguin <kun.yu@zilliz.com>pull/6102/head
parent
4e56218160
commit
9b549e0fa4
|
@ -2026,11 +2026,11 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
|
||||||
return errors.New(errMsg)
|
return errors.New(errMsg)
|
||||||
}
|
}
|
||||||
rt.Ids = rt.retrieve.Ids
|
rt.Ids = rt.retrieve.Ids
|
||||||
if len(rt.retrieve.OutputFields) == 0 {
|
|
||||||
schema, err := globalMetaCache.GetCollectionSchema(ctx, collectionName)
|
schema, err := globalMetaCache.GetCollectionSchema(ctx, collectionName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if len(rt.retrieve.OutputFields) == 0 {
|
||||||
for _, field := range schema.Fields {
|
for _, field := range schema.Fields {
|
||||||
if field.FieldID >= 100 {
|
if field.FieldID >= 100 {
|
||||||
rt.OutputFields = append(rt.OutputFields, field.Name)
|
rt.OutputFields = append(rt.OutputFields, field.Name)
|
||||||
|
@ -2038,6 +2038,20 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rt.OutputFields = rt.retrieve.OutputFields
|
rt.OutputFields = rt.retrieve.OutputFields
|
||||||
|
for _, field := range schema.Fields {
|
||||||
|
if field.IsPrimaryKey {
|
||||||
|
containPrimaryKey := false
|
||||||
|
for _, reqFields := range rt.retrieve.OutputFields {
|
||||||
|
if reqFields == field.Name {
|
||||||
|
containPrimaryKey = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !containPrimaryKey {
|
||||||
|
rt.OutputFields = append(rt.OutputFields, field.Name)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
travelTimestamp := rt.retrieve.TravelTimestamp
|
travelTimestamp := rt.retrieve.TravelTimestamp
|
||||||
|
|
Loading…
Reference in New Issue