Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCollection(t *testing.T, actualCollection *entity.Collection, expCollName string, ...)
- func CheckContainsCollection(t *testing.T, collections []*entity.Collection, collName string)
- func CheckContainsDb(t *testing.T, dbs []entity.Database, dbName string)
- func CheckContainsValue(fieldNames []interface{}, fieldName interface{}) bool
- func CheckErr(t *testing.T, actualErr error, expErrNil bool, expErrorMsg ...string)
- func CheckIndexResult(t *testing.T, actualIndexes []entity.Index, expIndexes ...entity.Index)
- func CheckInsertResult(t *testing.T, actualIds entity.Column, expIds entity.Column)
- func CheckNotContainsCollection(t *testing.T, collections []*entity.Collection, collName string)
- func CheckNotContainsDb(t *testing.T, dbs []entity.Database, dbName string)
- func CheckOutputFields(t *testing.T, actualColumns []entity.Column, expFields []string)
- func CheckPersistentSegments(t *testing.T, actualSegments []*entity.Segment, expNb int64)
- func CheckQueryIteratorResult(ctx context.Context, t *testing.T, itr *client.QueryIterator, expLimit int, ...)
- func CheckQueryResult(t *testing.T, actualColumns []entity.Column, expColumns []entity.Column)
- func CheckResourceGroup(t *testing.T, actualRg *entity.ResourceGroup, expRg *entity.ResourceGroup)
- func CheckSearchResult(t *testing.T, actualSearchResults []client.SearchResult, expNq int, ...)
- func ColumnIndexFunc(data []entity.Column, fieldName string) int
- func EqualArrayColumn(t *testing.T, columnA entity.Column, columnB entity.Column)
- func EqualColumn(t *testing.T, columnA entity.Column, columnB entity.Column)
- func EqualFields(t *testing.T, fieldA *entity.Field, fieldB *entity.Field)
- func EqualIntSlice(a []int, b []int) bool
- func EqualSchema(t *testing.T, schemaA entity.Schema, schemaB entity.Schema)
- func GenAllArrayData(start int, nb int, opts ...GenColumnDataOption) []entity.Column
- func GenAllArrayFields() []*entity.Field
- func GenAllArrayFieldsWithCapacity(capacity int64) []*entity.Field
- func GenAllFields() []*entity.Field
- func GenAllFieldsData(start int, nb int, dim int64, opts ...GenColumnDataOption) []entity.Column
- func GenAllFieldsRows(start int, nb int, dim int64, enableDynamicField bool, ...) []interface{}
- func GenAllFloatIndex(metricTypes ...entity.MetricType) []entity.Index
- func GenAllVectorsData(start int, nb int, dim int64, opts ...GenColumnDataOption) []entity.Column
- func GenAllVectorsRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}
- func GenArrayColumnData(start int, nb int, fieldName string, opts ...GenColumnDataOption) entity.Column
- func GenBFloat16Vector(dim int64) []byte
- func GenBatchSizes(limit int, batch int) []int
- func GenBinaryVector(dim int64) []byte
- func GenColumnData(start int, nb int, fieldType entity.FieldType, fieldName string, ...) entity.Column
- func GenDefaultArrayRows(start int, nb int, dim int64, enableDynamicField bool, ...) []interface{}
- func GenDefaultBinaryData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)
- func GenDefaultBinaryFields(autoID bool, dim int64) []*entity.Field
- func GenDefaultBinaryRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}
- func GenDefaultColumnData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)
- func GenDefaultFields(autoID bool) []*entity.Field
- func GenDefaultJSONData(columnName string, start int, nb int) *entity.ColumnJSONBytes
- func GenDefaultJSONRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}
- func GenDefaultRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}
- func GenDefaultSparseRows(start int, nb int, dim int64, maxLenSparse int, enableDynamicField bool) []interface{}
- func GenDefaultVarcharData(start int, nb int, dim int64) (entity.Column, entity.Column)
- func GenDefaultVarcharFields(autoID bool) []*entity.Field
- func GenDefaultVarcharRows(start int, nb int, dim int64, enableDynamicField bool) []interface{}
- func GenDynamicFieldData(start int, nb int) []entity.Column
- func GenField(name string, fieldType entity.FieldType, opts ...CreateFieldOption) *entity.Field
- func GenFloat16Vector(dim int64) []byte
- func GenFloatVector(dim int64) []float32
- func GenLongString(n int) string
- func GenRandomString(n int) string
- func GenSchema(name string, autoID bool, fields []*entity.Field, opts ...CreateSchemaOption) *entity.Schema
- func GenSearchVectors(nq int, dim int64, dataType entity.FieldType) []entity.Vector
- func GenSparseVector(maxLen int) entity.SparseEmbedding
- func GetAllFieldsName(enableDynamicField bool, onlyScalar bool) []string
- func GetInt64FloatVecArrayFieldsName(enableDynamicField bool) []string
- func MergeColumnsToDynamic(nb int, columns []entity.Column, columnName string) *entity.ColumnJSONBytes
- func PrintAllFieldNames(collName string, schemas *entity.Schema)
- type Array
- type CheckIteratorOption
- type CreateFieldOption
- func WithAutoID(autoID bool) CreateFieldOption
- func WithDim(dim int64) CreateFieldOption
- func WithElementType(eleType entity.FieldType) CreateFieldOption
- func WithFieldDescription(desc string) CreateFieldOption
- func WithIsPartitionKey(isPartitionKey bool) CreateFieldOption
- func WithIsPrimaryKey(isPrimaryKey bool) CreateFieldOption
- func WithMaxCapacity(maxCap int64) CreateFieldOption
- func WithMaxLength(maxLen int64) CreateFieldOption
- func WithTypeParams(key string, value string) CreateFieldOption
- type CreateSchemaOption
- type Dynamic
- type GenColumnDataOption
- type InvalidExprStruct
- type JSONStruct
Constants ¶
const ( DefaultIntFieldName = "int64" DefaultInt8FieldName = "int8" DefaultInt16FieldName = "int16" DefaultInt32FieldName = "int32" DefaultBoolFieldName = "bool" DefaultFloatFieldName = "float" DefaultDoubleFieldName = "double" DefaultVarcharFieldName = "varchar" DefaultJSONFieldName = "json" DefaultArrayFieldName = "array" DefaultFloatVecFieldName = "floatVec" DefaultBinaryVecFieldName = "binaryVec" DefaultFloat16VecFieldName = "fp16Vec" DefaultBFloat16VecFieldName = "bf16Vec" DefaultSparseVecFieldName = "sparseVec" DefaultDynamicNumberField = "dynamicNumber" DefaultDynamicStringField = "dynamicString" DefaultDynamicBoolField = "dynamicBool" DefaultDynamicListField = "dynamicList" DefaultBoolArrayField = "boolArray" DefaultInt8ArrayField = "int8Array" DefaultInt16ArrayField = "int16Array" DefaultInt32ArrayField = "int32Array" DefaultInt64ArrayField = "int64Array" DefaultFloatArrayField = "floatArray" DefaultDoubleArrayField = "doubleArray" DefaultVarcharArrayField = "varcharArray" RowCount = "row_count" DefaultTimeout = 120 DefaultDim = int64(128) DefaultShards = int32(2) DefaultNb = 3000 DefaultNq = 5 //DefaultNq = 1 DefaultTopK = 10 TestCapacity = 100 // default array field capacity TestMaxLen = 100 // default varchar field max length )
const default value for test
const ( MaxPartitionNum = 1024 DefaultDynamicFieldName = "$meta" QueryCountFieldName = "count(*)" DefaultPartition = "_default" DefaultIndexName = "_default_idx_102" DefaultIndexNameBinary = "_default_idx_100" DefaultRgName = "__default_resource_group" DefaultDb = "default" DefaultConsistencyLevel = entity.ClBounded MaxDim = 32768 MaxLength = int64(65535) MaxCollectionNameLen = 255 DefaultRgCapacity = 1000000 RetentionDuration = 40 // common.retentionDuration MaxCapacity = 4096 // max array capacity DefaultPartitionNum = 16 // default num_partitions MaxTopK = 16384 MaxVectorFieldNum = 4 DefaultBatchSize = 1000 )
const default value from milvus
Variables ¶
var AllArrayFieldsName = []string{ DefaultBoolArrayField, DefaultInt8ArrayField, DefaultInt16ArrayField, DefaultInt32ArrayField, DefaultInt64ArrayField, DefaultFloatArrayField, DefaultDoubleArrayField, DefaultVarcharArrayField, }
var AllFloatVectorsFieldNames = []string{ DefaultFloatVecFieldName, DefaultFloat16VecFieldName, DefaultBFloat16VecFieldName, }
var AllVectorsFieldsName = []string{ DefaultFloatVecFieldName, DefaultBinaryVecFieldName, DefaultFloat16VecFieldName, DefaultBFloat16VecFieldName, }
var ArrayFieldType = []entity.FieldType{ entity.FieldTypeBool, entity.FieldTypeInt8, entity.FieldTypeInt16, entity.FieldTypeInt32, entity.FieldTypeInt64, entity.FieldTypeFloat, entity.FieldTypeDouble, }
var IndexStateValue = map[string]int32{
"IndexStateNone": 0,
"Unissued": 1,
"InProgress": 2,
"Finished": 3,
"Failed": 4,
"Retry": 5,
}
var InvalidExpressions = []InvalidExprStruct{ {Expr: "id in [0]", ErrNil: true, ErrMsg: "fieldName(id) not found"}, {Expr: "int64 in not [0]", ErrNil: false, ErrMsg: "cannot parse expression"}, {Expr: "int64 > 10 AND int64 < 100", ErrNil: false, ErrMsg: "cannot parse expression"}, {Expr: "int64 < 10 OR int64 > 100", ErrNil: false, ErrMsg: "cannot parse expression"}, {Expr: "int64 < floatVec", ErrNil: false, ErrMsg: "not supported"}, {Expr: "floatVec in [0]", ErrNil: false, ErrMsg: "cannot be casted to FloatVector"}, {Expr: fmt.Sprintf("%s == 1", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s like 'a%%' ", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s like `a%%` ", DefaultJSONFieldName), ErrNil: false, ErrMsg: "cannot parse expression"}, {Expr: fmt.Sprintf("%s > 1", DefaultDynamicFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s[\"dynamicList\"] == [2, 3]", DefaultDynamicFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s['a'] == [2, 3]", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s['number'] == [2, 3]", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("%s[0] == [2, 3]", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("json_contains (%s['number'], 2)", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("json_contains (%s['list'], [2])", DefaultJSONFieldName), ErrNil: true, ErrMsg: ""}, {Expr: fmt.Sprintf("json_contains_all (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "contains_all operation element must be an array"}, {Expr: fmt.Sprintf("JSON_CONTAINS_ANY (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "contains_any operation element must be an array"}, {Expr: fmt.Sprintf("json_contains_aby (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "invalid expression: json_contains_aby"}, {Expr: fmt.Sprintf("json_contains_aby (%s['list'], 2)", DefaultJSONFieldName), ErrNil: false, ErrMsg: "invalid expression: json_contains_aby"}, {Expr: fmt.Sprintf("%s[-1] > %d", DefaultInt8ArrayField, TestCapacity), ErrNil: false, ErrMsg: "cannot parse expression"}, {Expr: fmt.Sprintf(fmt.Sprintf("%s[-1] > 1", DefaultJSONFieldName)), ErrNil: false, ErrMsg: "invalid expression"}, }
var SupportBinFlatMetricType = []entity.MetricType{ entity.JACCARD, entity.HAMMING, entity.SUBSTRUCTURE, entity.SUPERSTRUCTURE, }
var SupportBinIvfFlatMetricType = []entity.MetricType{ entity.JACCARD, entity.HAMMING, }
var SupportFloatMetricType = []entity.MetricType{ entity.L2, entity.IP, entity.COSINE, }
--- index utils ---
var UnsupportedSparseVecMetricsType = []entity.MetricType{ entity.L2, entity.COSINE, entity.JACCARD, entity.HAMMING, entity.SUBSTRUCTURE, entity.SUPERSTRUCTURE, }
Functions ¶
func CheckCollection ¶
func CheckCollection(t *testing.T, actualCollection *entity.Collection, expCollName string, expShardNum int32, expSchema *entity.Schema, expConsistencyLevel entity.ConsistencyLevel)
CheckCollection check collection
func CheckContainsCollection ¶
func CheckContainsCollection(t *testing.T, collections []*entity.Collection, collName string)
CheckContainsCollection check collections contains collName
func CheckContainsDb ¶ added in v2.2.5
CheckContainsDb check collections contains collName
func CheckContainsValue ¶ added in v2.4.2
func CheckContainsValue(fieldNames []interface{}, fieldName interface{}) bool
Checks whether the list contains the specified value
func CheckIndexResult ¶ added in v2.2.1
CheckIndexResult check index result, index type, metric type, index params
func CheckInsertResult ¶
CheckInsertResult check insert result, ids len (insert count), ids data (pks, but no auto ids)
func CheckNotContainsCollection ¶ added in v2.2.5
func CheckNotContainsCollection(t *testing.T, collections []*entity.Collection, collName string)
CheckNotContainsCollection check collections not contains collName
func CheckNotContainsDb ¶ added in v2.2.5
CheckNotContainsDb check collections contains collName
func CheckOutputFields ¶
CheckOutputFields check query output fields
func CheckPersistentSegments ¶ added in v2.2.1
CheckPersistentSegments check persistent segments
func CheckQueryIteratorResult ¶ added in v2.4.1
func CheckQueryIteratorResult(ctx context.Context, t *testing.T, itr *client.QueryIterator, expLimit int, opts ...CheckIteratorOption)
check queryIterator: result limit, each batch size, output fields
func CheckQueryResult ¶
CheckQueryResult check query result, column name, type and field
func CheckResourceGroup ¶ added in v2.2.2
func CheckResourceGroup(t *testing.T, actualRg *entity.ResourceGroup, expRg *entity.ResourceGroup)
func CheckSearchResult ¶
func CheckSearchResult(t *testing.T, actualSearchResults []client.SearchResult, expNq int, expTopK int)
CheckSearchResult check search result, check nq, topk, ids, score
func ColumnIndexFunc ¶ added in v2.3.3
ColumnIndexFunc generate column index
func EqualArrayColumn ¶ added in v2.4.1
EqualColumn assert field data is equal of two columns
func EqualColumn ¶
EqualColumn assert field data is equal of two columns
func EqualFields ¶
EqualFields equal two fields
func EqualIntSlice ¶ added in v2.4.1
func EqualSchema ¶
EqualSchema equal two schemas
func GenAllArrayData ¶ added in v2.3.3
func GenAllArrayData(start int, nb int, opts ...GenColumnDataOption) []entity.Column
func GenAllArrayFields ¶ added in v2.3.3
func GenAllArrayFieldsWithCapacity ¶ added in v2.3.3
GenAllArrayFieldsWithCapacity GenAllArrayFields gen all array fields
func GenAllFields ¶
GenAllFields gen fields with all scala field types
func GenAllFieldsData ¶ added in v2.2.7
func GenAllFieldsRows ¶ added in v2.2.7
func GenAllFieldsRows(start int, nb int, dim int64, enableDynamicField bool, opts ...GenColumnDataOption) []interface{}
func GenAllFloatIndex ¶ added in v2.2.1
func GenAllFloatIndex(metricTypes ...entity.MetricType) []entity.Index
GenAllFloatIndex gen all float vector index
func GenAllVectorsData ¶ added in v2.4.0
func GenAllVectorsRows ¶ added in v2.4.0
func GenArrayColumnData ¶ added in v2.3.3
func GenBFloat16Vector ¶ added in v2.4.0
func GenBatchSizes ¶ added in v2.4.1
func GenBinaryVector ¶
func GenColumnData ¶ added in v2.2.7
func GenColumnData(start int, nb int, fieldType entity.FieldType, fieldName string, opts ...GenColumnDataOption) entity.Column
GenColumnData GenColumnDataOption
func GenDefaultArrayRows ¶ added in v2.3.3
func GenDefaultArrayRows(start int, nb int, dim int64, enableDynamicField bool, opts ...GenColumnDataOption) []interface{}
func GenDefaultBinaryData ¶
func GenDefaultBinaryData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)
GenDefaultBinaryData gen default binary collection data
func GenDefaultBinaryFields ¶
GenDefaultBinaryFields gen default binary fields with int64, float, binaryVector field
func GenDefaultBinaryRows ¶ added in v2.2.7
func GenDefaultColumnData ¶
func GenDefaultColumnData(start int, nb int, dim int64) (entity.Column, entity.Column, entity.Column)
GenDefaultColumnData gen default column with data
func GenDefaultFields ¶
GenDefaultFields gen default fields with int64, float, floatVector field
func GenDefaultJSONData ¶ added in v2.2.7
func GenDefaultJSONData(columnName string, start int, nb int) *entity.ColumnJSONBytes
GenDefaultJSONData gen default column with data
func GenDefaultJSONRows ¶ added in v2.2.7
func GenDefaultRows ¶ added in v2.2.7
func GenDefaultSparseRows ¶ added in v2.4.0
func GenDefaultVarcharData ¶ added in v2.2.1
func GenDefaultVarcharFields ¶
GenDefaultVarcharFields gen default fields with varchar, floatVector field
func GenDefaultVarcharRows ¶ added in v2.2.7
func GenDynamicFieldData ¶ added in v2.2.7
func GenFloat16Vector ¶ added in v2.4.0
func GenFloatVector ¶
func GenSchema ¶
func GenSchema(name string, autoID bool, fields []*entity.Field, opts ...CreateSchemaOption) *entity.Schema
GenSchema gen schema
func GenSearchVectors ¶
GenSearchVectors gen search vectors
func GenSparseVector ¶ added in v2.4.0
func GenSparseVector(maxLen int) entity.SparseEmbedding
func GetAllFieldsName ¶ added in v2.4.0
return all fields name
func GetInt64FloatVecArrayFieldsName ¶ added in v2.4.2
func MergeColumnsToDynamic ¶ added in v2.2.7
func PrintAllFieldNames ¶ added in v2.4.2
Types ¶
type Array ¶ added in v2.3.3
type Array struct { BoolArray []bool `json:"boolArray" milvus:"name:boolArray"` Int8Array []int8 `json:"int8Array" milvus:"name:int8Array"` Int16Array []int16 `json:"int16Array" milvus:"name:int16Array"` Int32Array []int32 `json:"int32Array" milvus:"name:int32Array"` Int64Array []int64 `json:"int64Array" milvus:"name:int64Array"` FloatArray []float32 `json:"floatArray" milvus:"name:floatArray"` DoubleArray []float64 `json:"doubleArray" milvus:"name:doubleArray"` VarcharArray [][]byte `json:"varcharArray" milvus:"name:varcharArray"` }
func GenAllArrayRow ¶ added in v2.3.3
func GenAllArrayRow(index int, opts ...GenColumnDataOption) Array
type CheckIteratorOption ¶ added in v2.4.1
type CheckIteratorOption func(opt *checkIteratorOpt)
func WithExpBatchSize ¶ added in v2.4.1
func WithExpBatchSize(expBatchSize []int) CheckIteratorOption
func WithExpOutputFields ¶ added in v2.4.1
func WithExpOutputFields(expOutputFields []string) CheckIteratorOption
type CreateFieldOption ¶ added in v2.2.7
CreateFieldOption is an option that is used to modify entity.Schema
func WithAutoID ¶ added in v2.2.7
func WithAutoID(autoID bool) CreateFieldOption
func WithDim ¶ added in v2.2.7
func WithDim(dim int64) CreateFieldOption
func WithElementType ¶ added in v2.3.3
func WithElementType(eleType entity.FieldType) CreateFieldOption
func WithFieldDescription ¶ added in v2.2.7
func WithFieldDescription(desc string) CreateFieldOption
func WithIsPartitionKey ¶ added in v2.2.7
func WithIsPartitionKey(isPartitionKey bool) CreateFieldOption
func WithIsPrimaryKey ¶ added in v2.2.7
func WithIsPrimaryKey(isPrimaryKey bool) CreateFieldOption
func WithMaxCapacity ¶ added in v2.3.3
func WithMaxCapacity(maxCap int64) CreateFieldOption
func WithMaxLength ¶ added in v2.2.7
func WithMaxLength(maxLen int64) CreateFieldOption
func WithTypeParams ¶ added in v2.2.7
func WithTypeParams(key string, value string) CreateFieldOption
type CreateSchemaOption ¶ added in v2.2.7
CreateSchemaOption is an option that is used to modify entity.Schema
func WithDescription ¶ added in v2.2.7
func WithDescription(desc string) CreateSchemaOption
func WithEnableDynamicField ¶ added in v2.2.7
func WithEnableDynamicField(enableDF bool) CreateSchemaOption
type GenColumnDataOption ¶ added in v2.2.7
type GenColumnDataOption func(opt *genDataOpt)
GenColumnDataOption -- create column data --
func WithArrayCapacity ¶ added in v2.3.3
func WithArrayCapacity(capacity int64) GenColumnDataOption
func WithArrayElementType ¶ added in v2.3.3
func WithArrayElementType(eleType entity.FieldType) GenColumnDataOption
func WithSparseVectorLen ¶ added in v2.4.0
func WithSparseVectorLen(length int) GenColumnDataOption
func WithVectorDim ¶ added in v2.2.7
func WithVectorDim(dim int64) GenColumnDataOption
type InvalidExprStruct ¶ added in v2.3.2
InvalidExprStruct invalid expr