milvus/internal/querynode/reducer.go
Jiquan Long 8139106b51
Feat: count entities by expression (#22765)
Signed-off-by: longjiquan <jiquan.long@zilliz.com>
2023-03-16 19:31:55 +08:00

34 lines
972 B
Go

package querynode
import (
"context"
"github.com/milvus-io/milvus/internal/proto/segcorepb"
"github.com/milvus-io/milvus-proto/go-api/schemapb"
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/querypb"
)
type internalReducer interface {
Reduce([]*internalpb.RetrieveResults) (*internalpb.RetrieveResults, error)
}
func createInternalReducer(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) internalReducer {
if req.GetReq().GetIsCount() {
return &cntReducer{}
}
return newDefaultLimitReducer(ctx, req, schema)
}
type segCoreReducer interface {
Reduce([]*segcorepb.RetrieveResults) (*segcorepb.RetrieveResults, error)
}
func createSegCoreReducer(ctx context.Context, req *querypb.QueryRequest, schema *schemapb.CollectionSchema) segCoreReducer {
if req.GetReq().GetIsCount() {
return &cntReducerSegCore{}
}
return newDefaultLimitReducerSegcore(ctx, req, schema)
}