mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
fix: autoindex panic with flat index type (#29071)
issue: https://github.com/milvus-io/milvus/issues/29048 --------- Signed-off-by: longjiquan <jiquan.long@zilliz.com>
This commit is contained in:
parent
2f0c7a6544
commit
520c07ec9d
@ -4,6 +4,10 @@ type flatChecker struct {
|
|||||||
floatVectorBaseChecker
|
floatVectorBaseChecker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c flatChecker) StaticCheck(m map[string]string) error {
|
||||||
|
return c.staticCheck(m)
|
||||||
|
}
|
||||||
|
|
||||||
func newFlatChecker() IndexChecker {
|
func newFlatChecker() IndexChecker {
|
||||||
return &flatChecker{}
|
return &flatChecker{}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,3 +62,40 @@ func Test_flatChecker_CheckTrain(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_flatChecker_StaticCheck(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
params map[string]string
|
||||||
|
errIsNil bool
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
// metrics not found.
|
||||||
|
params: map[string]string{},
|
||||||
|
errIsNil: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// invalid metric.
|
||||||
|
params: map[string]string{
|
||||||
|
Metric: metric.HAMMING,
|
||||||
|
},
|
||||||
|
errIsNil: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// normal case.
|
||||||
|
params: map[string]string{
|
||||||
|
Metric: metric.L2,
|
||||||
|
},
|
||||||
|
errIsNil: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
c := newFlatChecker()
|
||||||
|
for _, test := range cases {
|
||||||
|
err := c.StaticCheck(test.params)
|
||||||
|
if test.errIsNil {
|
||||||
|
assert.NoError(t, err)
|
||||||
|
} else {
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user