Fix retrieve when output_fields is nil (#5623)

Signed-off-by: fishpenguin <kun.yu@zilliz.com>
pull/5616/head^2
yukun 2021-06-05 10:57:34 +08:00 committed by GitHub
parent a2ac3e040b
commit 45e7d26b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -1481,8 +1481,22 @@ func (rt *RetrieveTask) PreExecute(ctx context.Context) error {
zap.Any("requestID", rt.Base.MsgID), zap.Any("requestType", "retrieve"))
rt.Base.MsgType = commonpb.MsgType_Retrieve
if rt.retrieve.Ids == nil {
errMsg := "Retrieve ids is nil"
return errors.New(errMsg)
}
rt.Ids = rt.retrieve.Ids
rt.OutputFields = rt.retrieve.OutputFields
if len(rt.retrieve.OutputFields) == 0 {
schema, err := globalMetaCache.GetCollectionSchema(ctx, collectionName)
if err != nil {
return err
}
for _, field := range schema.Fields {
rt.OutputFields = append(rt.OutputFields, field.Name)
}
} else {
rt.OutputFields = rt.retrieve.OutputFields
}
rt.ResultChannelID = Params.RetrieveChannelNames[0]
rt.DbID = 0 // todo(yukun)