Fix incompatibility of stats log (#16277)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/16285/head
Xiaofan 2022-03-30 10:15:28 +08:00 committed by GitHub
parent 0baa8c60a5
commit b6b3c9863c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 8 deletions

View File

@ -56,14 +56,16 @@ func (stats *PrimaryKeyStats) UnmarshalJSON(data []byte) error {
}
stats.PkType = int64(schemapb.DataType_Int64)
var typeValue int64
err = json.Unmarshal(*messageMap["pkType"], &typeValue)
if err != nil {
return err
}
// valid pkType
if typeValue > 0 {
stats.PkType = typeValue
if value, ok := messageMap["pkType"]; ok && value != nil {
var typeValue int64
err = json.Unmarshal(*value, &typeValue)
if err != nil {
return err
}
// valid pkType
if typeValue > 0 {
stats.PkType = typeValue
}
}
switch schemapb.DataType(stats.PkType) {