Fix nil stats from DeserializeStats (#10255)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/10279/head
congqixia 2021-10-20 14:26:35 +08:00 committed by GitHub
parent 97baf694b9
commit c3518b8c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -88,8 +88,8 @@ func (sr *StatsReader) GetInt64Stats() (*Int64Stats, error) {
}
func DeserializeStats(blobs []*Blob) ([]*Int64Stats, error) {
results := make([]*Int64Stats, len(blobs))
for i, blob := range blobs {
results := make([]*Int64Stats, 0, len(blobs))
for _, blob := range blobs {
if blob.Value == nil {
continue
}
@ -99,8 +99,7 @@ func DeserializeStats(blobs []*Blob) ([]*Int64Stats, error) {
if err != nil {
return nil, err
}
results[i] = stats
results = append(results, stats)
}
return results, nil
}