mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
- issue: #41291 - pr: #41318 --------- Signed-off-by: SimFG <bang.fu@zilliz.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
29 lines
758 B
Go
29 lines
758 B
Go
package indexparamcheck
|
|
|
|
import (
|
|
"github.com/cockroachdb/errors"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/v2/schemapb"
|
|
"github.com/milvus-io/milvus/pkg/v2/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 errors.New("STL_SORT are only supported on numeric field")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func newSTLSORTChecker() *STLSORTChecker {
|
|
return &STLSORTChecker{}
|
|
}
|