fix: duplicate dynamic field data by mistake (#30043)

issue: #30000 
pr: https://github.com/milvus-io/milvus/pull/30042

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
This commit is contained in:
zhenshan.cao 2024-01-17 00:20:55 +08:00 committed by GitHub
parent 9f6a19c56c
commit 9aceff5a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -406,7 +406,7 @@ func anyToColumns(rows []map[string]interface{}, sch *schemapb.CollectionSchema)
fieldData := make(map[string]*schemapb.FieldData)
for _, field := range sch.Fields {
// skip auto id pk field
if field.IsPrimaryKey && field.AutoID {
if (field.IsPrimaryKey && field.AutoID) || field.IsDynamic {
continue
}
var data interface{}
@ -461,15 +461,13 @@ func anyToColumns(rows []map[string]interface{}, sch *schemapb.CollectionSchema)
if err != nil {
return nil, err
}
for idx, field := range sch.Fields {
// skip auto id pk field
if field.IsPrimaryKey && field.AutoID {
if (field.IsPrimaryKey && field.AutoID) || field.IsDynamic {
// remove pk field from candidates set, avoid adding it into dynamic column
delete(set, field.Name)
continue
}
candi, ok := set[field.Name]
if !ok {
return nil, fmt.Errorf("row %d does not has field %s", idx, field.Name)