Fix a crash bug of bulkinsert for dynamic field (#25982)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
This commit is contained in:
groot 2023-07-28 15:25:03 +08:00 committed by GitHub
parent eaf53c7b39
commit c2693ea284
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -445,11 +445,12 @@ func fillDynamicData(blockData BlockData, collectionSchema *schemapb.CollectionS
}
}
if dynamicData.RowNum() == 0 {
// fill the dynamic data by row count
if dynamicData.RowNum() < rowCount {
// fill the dynamic data by an empty JSON object, make sure the row count is eaual to other fields
data := dynamicData.(*storage.JSONFieldData)
bs := []byte("{}")
for i := 0; i < rowCount; i++ {
dynamicRowCount := dynamicData.RowNum()
for i := 0; i < rowCount-dynamicRowCount; i++ {
data.Data = append(data.Data, bs)
}
}