mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-05 05:18:52 +08:00
bec9f2c182
* Split segcore and plan proto for future feature Signed-off-by: fluorinedog <fluorinedog@gmail.com> * lint Signed-off-by: fluorinedog <fluorinedog@gmail.com>
55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
package querynode
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"github.com/milvus-io/milvus/internal/proto/schemapb"
|
|
"github.com/milvus-io/milvus/internal/proto/segcorepb"
|
|
)
|
|
|
|
func TestRetrieve_Merge(t *testing.T) {
|
|
|
|
col1 := &schemapb.FieldData{
|
|
Field: &schemapb.FieldData_Scalars{
|
|
Scalars: &schemapb.ScalarField{
|
|
Data: &schemapb.ScalarField_IntData{
|
|
IntData: &schemapb.IntArray{
|
|
Data: []int32{1, 2, 3},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
col2 := &schemapb.FieldData{
|
|
Field: &schemapb.FieldData_Vectors{
|
|
Vectors: &schemapb.VectorField{
|
|
Data: &schemapb.VectorField_FloatVector{
|
|
FloatVector: &schemapb.FloatArray{
|
|
Data: []float32{1, 1, 2, 2, 3, 3},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
subRes := &segcorepb.RetrieveResults{
|
|
Ids: &schemapb.IDs{
|
|
IdField: &schemapb.IDs_IntId{
|
|
IntId: &schemapb.LongArray{
|
|
Data: []int64{1, 2, 3},
|
|
},
|
|
},
|
|
},
|
|
FieldsData: []*schemapb.FieldData{
|
|
col1,
|
|
col2,
|
|
},
|
|
}
|
|
finalRes, err := mergeRetrieveResults([]*segcorepb.RetrieveResults{subRes, subRes})
|
|
assert.NoError(t, err)
|
|
println(finalRes.String())
|
|
}
|