mirror of
https://github.com/milvus-io/milvus.git
synced 2026-07-21 10:15:43 +00:00
fix: fix alter collection failed for STRUCT sub-fields (#45041)
issue: https://github.com/milvus-io/milvus/issues/45001 ref: https://github.com/milvus-io/milvus/issues/42148 --------- Signed-off-by: SpadeA <tangchenjie1210@gmail.com>
This commit is contained in:
@@ -388,6 +388,17 @@ func ResetFieldProperties(coll *model.Collection, fieldName string, newProps []*
|
||||
return nil
|
||||
}
|
||||
}
|
||||
for _, structField := range coll.StructArrayFields {
|
||||
if structField.Name == fieldName {
|
||||
return merr.WrapErrParameterInvalidMsg("struct field has no properties to alter", fieldName)
|
||||
}
|
||||
for i, field := range structField.Fields {
|
||||
if field.Name == fieldName {
|
||||
structField.Fields[i].TypeParams = newProps
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return merr.WrapErrParameterInvalidMsg("field %s does not exist in collection", fieldName)
|
||||
}
|
||||
|
||||
@@ -397,6 +408,16 @@ func GetFieldProperties(coll *model.Collection, fieldName string) ([]*commonpb.K
|
||||
return field.TypeParams, nil
|
||||
}
|
||||
}
|
||||
for _, structField := range coll.StructArrayFields {
|
||||
if structField.Name == fieldName {
|
||||
return nil, merr.WrapErrParameterInvalidMsg("struct field has no properties", fieldName)
|
||||
}
|
||||
for _, field := range structField.Fields {
|
||||
if field.Name == fieldName {
|
||||
return field.TypeParams, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil, merr.WrapErrParameterInvalidMsg("field %s does not exist in collection", fieldName)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user