mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-30 02:48:45 +08:00
d7b2ffe5aa
issue: #34298 Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
29 lines
729 B
Go
29 lines
729 B
Go
package indexparamcheck
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
|
"github.com/milvus-io/milvus/pkg/util/typeutil"
|
|
)
|
|
|
|
// STLSORTChecker checks if a STL_SORT index can be built.
|
|
type STLSORTChecker struct {
|
|
scalarIndexChecker
|
|
}
|
|
|
|
func (c *STLSORTChecker) CheckTrain(dataType schemapb.DataType, params map[string]string) error {
|
|
return c.scalarIndexChecker.CheckTrain(dataType, params)
|
|
}
|
|
|
|
func (c *STLSORTChecker) CheckValidDataType(indexType IndexType, field *schemapb.FieldSchema) error {
|
|
if !typeutil.IsArithmetic(field.GetDataType()) {
|
|
return fmt.Errorf("STL_SORT are only supported on numeric field")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func newSTLSORTChecker() *STLSORTChecker {
|
|
return &STLSORTChecker{}
|
|
}
|