mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
8139106b51
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
38 lines
881 B
Go
38 lines
881 B
Go
package querynode
|
|
|
|
import (
|
|
"github.com/milvus-io/milvus/internal/proto/internalpb"
|
|
"github.com/milvus-io/milvus/internal/proto/segcorepb"
|
|
"github.com/milvus-io/milvus/internal/util/funcutil"
|
|
)
|
|
|
|
type cntReducer struct {
|
|
}
|
|
|
|
func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*internalpb.RetrieveResults, error) {
|
|
cnt := int64(0)
|
|
for _, res := range results {
|
|
c, err := funcutil.CntOfInternalResult(res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
cnt += c
|
|
}
|
|
return funcutil.WrapCntToInternalResult(cnt), nil
|
|
}
|
|
|
|
type cntReducerSegCore struct {
|
|
}
|
|
|
|
func (r *cntReducerSegCore) Reduce(results []*segcorepb.RetrieveResults) (*segcorepb.RetrieveResults, error) {
|
|
cnt := int64(0)
|
|
for _, res := range results {
|
|
c, err := funcutil.CntOfSegCoreResult(res)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
cnt += c
|
|
}
|
|
return funcutil.WrapCntToSegCoreResult(cnt), nil
|
|
}
|