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

issue : #30000

Signed-off-by: zhenshan.cao <zhenshan.cao@zilliz.com>
pull/30073/head
zhenshan.cao 2024-01-17 19:02:56 +08:00 committed by GitHub
parent 80465a01b5
commit 31740445fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

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)