mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 09:08:43 +08:00
fix: reject GEOMETRY and TIMESTAMPTZ in STRUCT (#44937)
issue: https://github.com/milvus-io/milvus/issues/44930 Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
parent
c2ed2cfc39
commit
34f54da155
@ -655,13 +655,9 @@ func ValidateFieldsInStruct(field *schemapb.FieldSchema, schema *schemapb.Collec
|
||||
return fmt.Errorf("Nested array is not supported %s", field.Name)
|
||||
}
|
||||
|
||||
if field.ElementType == schemapb.DataType_JSON {
|
||||
return fmt.Errorf("JSON is not supported for fields in struct, fieldName = %s", field.Name)
|
||||
}
|
||||
|
||||
if field.DataType == schemapb.DataType_Array {
|
||||
if typeutil.IsVectorType(field.GetElementType()) {
|
||||
return fmt.Errorf("Inconsistent schema: element type of array field %s is a vector type", field.Name)
|
||||
if err := validateElementType(field.GetElementType()); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// TODO(SpadeA): only support float vector now
|
||||
|
||||
@ -3914,7 +3914,7 @@ func TestValidateFieldsInStruct(t *testing.T) {
|
||||
}
|
||||
err := ValidateFieldsInStruct(field, schema)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "JSON is not supported for fields in struct")
|
||||
assert.Contains(t, err.Error(), "is not supported")
|
||||
})
|
||||
|
||||
t.Run("nested array not supported", func(t *testing.T) {
|
||||
@ -3946,7 +3946,7 @@ func TestValidateFieldsInStruct(t *testing.T) {
|
||||
}
|
||||
err := ValidateFieldsInStruct(field, schema)
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "element type of array field array_with_vector is a vector type")
|
||||
assert.Contains(t, err.Error(), "element type FloatVector is not supported")
|
||||
})
|
||||
|
||||
t.Run("array of vector field with non-vector element type", func(t *testing.T) {
|
||||
@ -4060,7 +4060,6 @@ func TestValidateFieldsInStruct(t *testing.T) {
|
||||
schemapb.DataType_Int64,
|
||||
schemapb.DataType_Float,
|
||||
schemapb.DataType_Double,
|
||||
schemapb.DataType_String,
|
||||
}
|
||||
|
||||
for _, dt := range validScalarTypes {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user