2023-03-16 19:31:55 +08:00
|
|
|
package proxy
|
|
|
|
|
|
|
|
import (
|
2023-09-19 10:05:22 +08:00
|
|
|
"context"
|
2023-03-16 19:31:55 +08:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-09-21 09:45:27 +08:00
|
|
|
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/planpb"
|
2023-03-16 19:31:55 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test_createMilvusReducer(t *testing.T) {
|
|
|
|
n := &planpb.PlanNode{
|
|
|
|
Node: &planpb.PlanNode_Query{
|
|
|
|
Query: &planpb.QueryPlanNode{
|
|
|
|
IsCount: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
var r milvusReducer
|
2023-09-19 10:05:22 +08:00
|
|
|
ctx := context.Background()
|
2023-03-16 19:31:55 +08:00
|
|
|
|
2023-09-19 10:05:22 +08:00
|
|
|
r = createMilvusReducer(ctx, nil, nil, nil, n, "")
|
2023-03-16 19:31:55 +08:00
|
|
|
_, ok := r.(*defaultLimitReducer)
|
|
|
|
assert.True(t, ok)
|
|
|
|
|
|
|
|
n.Node.(*planpb.PlanNode_Query).Query.IsCount = true
|
2023-09-19 10:05:22 +08:00
|
|
|
r = createMilvusReducer(ctx, nil, nil, nil, n, "")
|
2023-03-16 19:31:55 +08:00
|
|
|
_, ok = r.(*cntReducer)
|
|
|
|
assert.True(t, ok)
|
|
|
|
}
|