mirror of https://github.com/milvus-io/milvus.git
Fix retrieve when output_fields is nil (#5623)
Signed-off-by: fishpenguin <kun.yu@zilliz.com>pull/5616/head^2
parent
a2ac3e040b
commit
45e7d26b01
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue