mirror of https://github.com/milvus-io/milvus.git
Correct empty retrieve result handling (#11219)
Signed-off-by: yudong.cai <yudong.cai@zilliz.com>pull/11248/head
parent
0ae2ef51c7
commit
0fac38000c
|
@ -2291,7 +2291,7 @@ func mergeRetrieveResults(retrieveResults []*internalpb.RetrieveResults) (*milvu
|
|||
// merge results and remove duplicates
|
||||
for _, rr := range retrieveResults {
|
||||
// skip empty result, it will break merge result
|
||||
if rr == nil || rr.Ids == nil {
|
||||
if rr == nil || rr.Ids == nil || rr.Ids.GetIntId() == nil || len(rr.Ids.GetIntId().Data) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -2302,7 +2302,7 @@ func mergeRetrieveResults(retrieveResults []*internalpb.RetrieveResults) (*milvu
|
|||
}
|
||||
|
||||
if len(ret.FieldsData) != len(rr.FieldsData) {
|
||||
return nil, fmt.Errorf("mismatch FieldData in RetrieveResults")
|
||||
return nil, fmt.Errorf("mismatch FieldData in proxy RetrieveResults, expect %d get %d", len(ret.FieldsData), len(rr.FieldsData))
|
||||
}
|
||||
|
||||
for i, id := range rr.Ids.GetIntId().GetData() {
|
||||
|
@ -2319,6 +2319,12 @@ func mergeRetrieveResults(retrieveResults []*internalpb.RetrieveResults) (*milvu
|
|||
log.Debug("skip duplicated query result", zap.Int64("count", skipDupCnt))
|
||||
}
|
||||
|
||||
if ret == nil {
|
||||
ret = &milvuspb.QueryResults{
|
||||
FieldsData: []*schemapb.FieldData{},
|
||||
}
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -1216,7 +1216,7 @@ func mergeRetrieveResults(retrieveResults []*segcorepb.RetrieveResults) (*segcor
|
|||
// merge results and remove duplicates
|
||||
for _, rr := range retrieveResults {
|
||||
// skip empty result, it will break merge result
|
||||
if rr == nil || len(rr.Offset) == 0 {
|
||||
if rr == nil || rr.Offset == nil || len(rr.Offset) == 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ func mergeRetrieveResults(retrieveResults []*segcorepb.RetrieveResults) (*segcor
|
|||
}
|
||||
|
||||
if len(ret.FieldsData) != len(rr.FieldsData) {
|
||||
return nil, fmt.Errorf("mismatch FieldData in RetrieveResults")
|
||||
return nil, fmt.Errorf("mismatch FieldData in querynode RetrieveResults, expect %d get %d", len(ret.FieldsData), len(rr.FieldsData))
|
||||
}
|
||||
|
||||
dstIds := ret.Ids.GetIntId()
|
||||
|
|
Loading…
Reference in New Issue