2024-03-21 10:37:08 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-10-28 10:11:37 +08:00
|
|
|
func (c *STLSORTChecker) CheckTrain(dataType schemapb.DataType, params map[string]string) error {
|
|
|
|
return c.scalarIndexChecker.CheckTrain(dataType, params)
|
2024-03-21 10:37:08 +08:00
|
|
|
}
|
|
|
|
|
2024-10-28 10:11:37 +08:00
|
|
|
func (c *STLSORTChecker) CheckValidDataType(indexType IndexType, field *schemapb.FieldSchema) error {
|
2024-07-05 15:50:10 +08:00
|
|
|
if !typeutil.IsArithmetic(field.GetDataType()) {
|
2024-03-21 10:37:08 +08:00
|
|
|
return fmt.Errorf("STL_SORT are only supported on numeric field")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func newSTLSORTChecker() *STLSORTChecker {
|
|
|
|
return &STLSORTChecker{}
|
|
|
|
}
|