mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
Add primaryKey to output fields (#6094)
Signed-off-by: fishpenguin <kun.yu@zilliz.com>
This commit is contained in:
parent
4e56218160
commit
9b549e0fa4
@ -2026,11 +2026,11 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
rt.Ids = rt.retrieve.Ids
|
||||
if len(rt.retrieve.OutputFields) == 0 {
|
||||
schema, err := globalMetaCache.GetCollectionSchema(ctx, collectionName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(rt.retrieve.OutputFields) == 0 {
|
||||
for _, field := range schema.Fields {
|
||||
if field.FieldID >= 100 {
|
||||
rt.OutputFields = append(rt.OutputFields, field.Name)
|
||||
@ -2038,6 +2038,20 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
|
||||
}
|
||||
} else {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user