mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
Fill output fields for count request (#27967)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
parent
98e2aad752
commit
6913283716
@ -6,7 +6,9 @@ import (
|
||||
"github.com/milvus-io/milvus/internal/util/funcutil"
|
||||
)
|
||||
|
||||
type cntReducer struct{}
|
||||
type cntReducer struct {
|
||||
collectionName string
|
||||
}
|
||||
|
||||
func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.QueryResults, error) {
|
||||
cnt := int64(0)
|
||||
@ -17,5 +19,7 @@ func (r *cntReducer) Reduce(results []*internalpb.RetrieveResults) (*milvuspb.Qu
|
||||
}
|
||||
cnt += c
|
||||
}
|
||||
return funcutil.WrapCntToQueryResults(cnt), nil
|
||||
res := funcutil.WrapCntToQueryResults(cnt)
|
||||
res.CollectionName = r.collectionName
|
||||
return res, nil
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ type milvusReducer interface {
|
||||
|
||||
func createMilvusReducer(ctx context.Context, params *queryParams, req *internalpb.RetrieveRequest, schema *schemapb.CollectionSchema, plan *planpb.PlanNode, collectionName string) milvusReducer {
|
||||
if plan.GetQuery().GetIsCount() {
|
||||
return &cntReducer{}
|
||||
return &cntReducer{
|
||||
collectionName: collectionName,
|
||||
}
|
||||
}
|
||||
return newDefaultLimitReducer(ctx, params, req, schema, collectionName)
|
||||
}
|
||||
|
@ -207,6 +207,7 @@ func (t *queryTask) createPlan(ctx context.Context) error {
|
||||
if cntMatch {
|
||||
var err error
|
||||
t.plan, err = createCntPlan(t.request.GetExpr(), schema)
|
||||
t.userOutputFields = []string{"count(*)"}
|
||||
return err
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user