Replies: 9 comments 32 replies
-
well...
I do not thinks to implement |
Beta Was this translation helpful? Give feedback.
-
I have two comments.
|
Beta Was this translation helpful? Give feedback.
-
I have created an PR for it |
Beta Was this translation helpful? Give feedback.
-
I think convert.go shoule be located at internal/conv |
Beta Was this translation helpful? Give feedback.
-
@kevindiu e.g. - internal/test
|- request
| |- insert.go // helper for generating insert request |
Beta Was this translation helpful? Give feedback.
-
@kmrmt @vankichi Since we need to know the inserted vector & ID beforehand to implement the test case func BuildIndex(t ObjectType, insertReq *payload.Multi_insertrequest, ngtCfg *config.NGT, srvOpts []service.Option) (Server, error) {
// create ngt with ngtCfg
// create server with srvOpts
// insert vector into ngt/server
// create index
// return server with inserted vec
} to insert the vector through the multiInsertRequest object. What do you think? |
Beta Was this translation helpful? Give feedback.
-
@kmrmt @vankichi For func convertVectorUint8ToFloat32(vector []uint8) (ret []float32) { // put it in internal/test/data/vector package
ret = make([]float32, len(vector))
for i, e := range vector {
ret[i] = float32(e)
}
return
}
func convertVectorsUint8ToFloat32(vectors [][]uint8) (ret [][]float32) { // put it in internal/test/data/vector package
ret = make([][]float32, 0, len(vectors))
for _, v := range vectors {
ret = append(ret, convertVectorUint8ToFloat32(v))
}
return
}
func fill(f float32, dim int) (v []float32) { // duplicated impl, will remove it
v = make([]float32, dim)
for i := range v {
v[i] = f
}
return
} |
Beta Was this translation helpful? Give feedback.
-
I have listed up the helper functions in the pkg/agent/handler test implementation.
I have designed the following packageing for the functions.
The reason I design like it is because base on the package name we can easily understand what kind of helper function we are going to use.
Summary:
Refactor the following helper functions in pkg/agent/handler/grpc/handler.go:
Structure:
internal
|- test
|- |- data
|- |- |- request
|- |- |- |- insert.go
|- |- |- |- |- genMultiInsertReq()
|- |- |- |- |- genSameVecMultiInsertReq()
|- |- |- |- object.go
|- |- |- |- |- genObjectLocations()
|- |- |- vector
|- |- |- |- gen.go
|- |- |- |- |- genF32Vec()
|- |- |- |- |- genIntVec()
|- |- |- |- |- genSameValueVec()
|- |- |- |- |- convertVectorUint8ToFloat32()
|- |- |- |- |- convertVectorsUint8ToFloat32()
|- conv
|- |- conv.go
|- |- |- utf8ToSjis()
|- |- |- utf8ToEucjp()
The following implementation will be removed.
Also we will implement the
BuildIndex()
in the test file to return the NGT server object which finished inserting and indexing the random vectors.The following helper function will not be refactored.
genAlreadyExistsErr()
will not be refactored as it is only used inTest_MultiInsert()
Original design:
internal/test/data/charset/convert.go
internal/test/data/vector/helper.go (package existed)
internal/test/data/request/insert_req.go
Changes from original design
genAlreadyExistsErr()
as it is only used in MultiInsert testgenXXXVec()
to existing fileinternal/test/data/vector/gen.go
instead of creating new fileutf8ToXXXX()
tointernal/conv
package instead ofinternal/test/data/
packageBeta Was this translation helpful? Give feedback.
All reactions