Closed ThreadDao closed 7 months ago
milvus: master-20240415-fd971a43-amd64 sdk: go master
search with sparse vector field and panic:
2024/04/17 16:02:26 milvus_client.go:14: (ApiRequest): func [Search], args: [context.Background.WithDeadline(2024-04-17 16:06:15.992850747 +0800 CST m=+240.004269159 [3m49.172233259s]) VSWV [] [*] nq=1 sparseVec IP 10 0xc000011c38 []] 2024/04/17 16:02:26 milvus_client.go:14: (ApiRequest): func [DropCollection], args: [context.Background.WithDeadline(2024-04-17 16:06:15.992850747 +0800 CST m=+240.004269159 [3m49.172050076s]) VSWV] 2024/04/17 16:02:26 milvus_client.go:21: (ApiResponse): func [DropCollection], results: [] 2024/04/17 16:02:26 milvus_client.go:14: (ApiRequest): func [Close], args: [] 2024/04/17 16:02:26 milvus_client.go:21: (ApiResponse): func [Close], results: [] --- FAIL: TestSearchSparseVector (10.84s) panic: runtime error: slice bounds out of range [60:48] [recovered] panic: runtime error: slice bounds out of range [60:48] goroutine 6 [running]: testing.tRunner.func1.2({0xba6320, 0xc0004cab88}) /usr/local/go/src/testing/testing.go:1389 +0x24e testing.tRunner.func1() /usr/local/go/src/testing/testing.go:1392 +0x39f panic({0xba6320, 0xc0004cab88}) /usr/local/go/src/runtime/panic.go:838 +0x207 github.com/milvus-io/milvus-sdk-go/v2/entity.sliceSparseEmbedding.Serialize({{0xc0004cab40, 0x6, 0x6}, {0xc0004cab58, 0x6, 0x6}, 0xc, 0x6}) /home/zong/zong/go-projects/milvus-sdk-go/entity/columns_sparse.go:66 +0x225 github.com/milvus-io/milvus-sdk-go/v2/client.vector2Placeholder({0xc00031da80, 0x1, 0xc000f45838?}) /home/zong/zong/go-projects/milvus-sdk-go/client/insert.go:520 +0x1e5 github.com/milvus-io/milvus-sdk-go/v2/client.vector2PlaceholderGroupBytes({0xc00031da80?, 0xc000f45838?, 0xc0e037?}) /home/zong/zong/go-projects/milvus-sdk-go/client/insert.go:489 +0x25 github.com/milvus-io/milvus-sdk-go/v2/client.prepareSearchRequest({0xc00048e168, 0x4}, {0x1219190, 0x0, 0x0}, {0x0, 0x0}, {0xc00031da90, 0x1, 0x1}, ...) /home/zong/zong/go-projects/milvus-sdk-go/client/data.go:418 +0x75a github.com/milvus-io/milvus-sdk-go/v2/client.(*GrpcClient).Search(0xc0000888c0, {0xd18978, 0xc000046ba0}, {0xc00048e168, 0x4}, {0x1219190, 0x0, 0x0}, {0x0, 0x0}, ...) /home/zong/zong/go-projects/milvus-sdk-go/client/data.go:115 +0x210 github.com/milvus-io/milvus-sdk-go/v2/test/base.(*MilvusClient).Search(0xc00048c4f0, {0xd18978?, 0xc000046ba0}, {0xc00048e168, 0x4}, {0x1219190, 0x0, 0x0}, {0x0, 0x0}, ...) /home/zong/zong/go-projects/milvus-sdk-go/test/base/milvus_client.go:423 +0x5a3 github.com/milvus-io/milvus-sdk-go/v2/test/testcases.TestSearchSparseVector(0x0?) /home/zong/zong/go-projects/milvus-sdk-go/test/testcases/search_test.go:1621 +0x77b testing.tRunner(0xc00036c9c0, 0xc56a80) /usr/local/go/src/testing/testing.go:1439 +0x102 created by testing.(*T).Run /usr/local/go/src/testing/testing.go:1486 +0x35f
case:
func TestSearchSparseVector(t *testing.T) { //t.Skip("https://github.com/milvus-io/milvus-sdk-go/issues/725") idxInverted := entity.NewGenericIndex(common.DefaultSparseVecFieldName, "SPARSE_INVERTED_INDEX", map[string]string{"drop_ratio_build": "0.2", "metric_type": "IP"}) idxWand := entity.NewGenericIndex(common.DefaultSparseVecFieldName, "SPARSE_WAND", map[string]string{"drop_ratio_build": "0.3", "metric_type": "IP"}) for _, idx := range []entity.Index{idxInverted, idxWand} { ctx := createContext(t, time.Second*common.DefaultTimeout*2) // connect mc := createMilvusClient(ctx, t) // create -> insert [0, 3000) -> flush -> index -> load cp := CollectionParams{CollectionFieldsType: Int64VarcharSparseVec, AutoID: false, EnableDynamicField: true, ShardsNum: common.DefaultShards, Dim: common.DefaultDim, MaxLength: common.TestMaxLen} dp := DataParams{DoInsert: true, CollectionFieldsType: Int64VarcharSparseVec, start: 0, nb: common.DefaultNb * 4, dim: common.DefaultDim, EnableDynamicField: true} // index params idxHnsw, _ := entity.NewIndexHNSW(entity.L2, 8, 96) ips := []IndexParams{ {BuildIndex: true, Index: idx, FieldName: common.DefaultSparseVecFieldName, async: false}, {BuildIndex: true, Index: idxHnsw, FieldName: common.DefaultFloatVecFieldName, async: false}, } collName := prepareCollection(ctx, t, mc, cp, WithDataParams(dp), WithIndexParams(ips), WithCreateOption(client.WithConsistencyLevel(entity.ClStrong))) // search queryVec := common.GenSearchVectors(1, common.DefaultDim, entity.FieldTypeSparseVector) sp, _ := entity.NewIndexSparseInvertedSearchParam(0.2) resSearch, errSearch := mc.Search(ctx, collName, []string{}, "", []string{"*"}, queryVec, common.DefaultSparseVecFieldName, entity.IP, common.DefaultTopK, sp) common.CheckErr(t, errSearch, true) common.CheckSearchResult(t, resSearch, 1, common.DefaultTopK) outputFields := []string{common.DefaultIntFieldName, common.DefaultVarcharFieldName, common.DefaultFloatVecFieldName, common.DefaultSparseVecFieldName, common.DefaultDynamicFieldName} common.CheckOutputFields(t, resSearch[0].Fields, outputFields) } }
No response
/assign @congqixia
fixed
Is there an existing issue for this?
Current Behavior
milvus: master-20240415-fd971a43-amd64 sdk: go master
search with sparse vector field and panic:
case:
Expected Behavior
No response
Steps To Reproduce
No response
Environment
No response
Anything else?
No response