mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-01-07 19:31:51 +08:00
Fix RHNSWPQ pqm divide by zero (#18700)
See also: #18671 Signed-off-by: yangxuan <xuan.yang@zilliz.com> Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
parent
cf1c5902e5
commit
a782ded0bd
@ -419,7 +419,7 @@ func (adapter *RHNSWPQConfAdapter) CheckTrain(params map[string]string) bool {
|
||||
return false
|
||||
}
|
||||
pqm, err := strconv.Atoi(pqmStr)
|
||||
if err != nil {
|
||||
if err != nil || pqm == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
@ -461,6 +461,9 @@ func TestRHNSWPQConfAdapter_CheckTrain(t *testing.T) {
|
||||
invalidParamsPQM := copyParams(validParams)
|
||||
invalidParamsPQM[PQM] = "NAN"
|
||||
|
||||
invalidParamsPQMZero := copyParams(validParams)
|
||||
invalidParamsPQMZero[PQM] = "0"
|
||||
|
||||
cases := []struct {
|
||||
params map[string]string
|
||||
want bool
|
||||
@ -473,6 +476,7 @@ func TestRHNSWPQConfAdapter_CheckTrain(t *testing.T) {
|
||||
{invalidMParamsMax, false},
|
||||
{invalidParamsWithoutPQM, false},
|
||||
{invalidParamsPQM, false},
|
||||
{invalidParamsPQMZero, false},
|
||||
}
|
||||
|
||||
adapter := newRHNSWPQConfAdapter()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user