From a99ef59d71059cd5698e22dbafcb70bf042bbb3f Mon Sep 17 00:00:00 2001 From: shaoting-huang Date: Fri, 14 Jun 2024 20:29:48 +0800 Subject: [PATCH] refactor Signed-off-by: shaoting-huang --- internal/storage/data_codec.go | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/internal/storage/data_codec.go b/internal/storage/data_codec.go index 5262858f93803..10f29178722b5 100644 --- a/internal/storage/data_codec.go +++ b/internal/storage/data_codec.go @@ -253,25 +253,10 @@ func (insertCodec *InsertCodec) Serialize(partitionID UniqueID, segmentID Unique var dim int64 if typeutil.IsVectorType(field.DataType) { switch field.DataType { - case schemapb.DataType_FloatVector: - dim, err = typeutil.GetDim(field) - if err != nil { - return nil, err - } - eventWriter, err = writer.NextInsertEventWriter(int(dim)) - case schemapb.DataType_BinaryVector: - dim, err = typeutil.GetDim(field) - if err != nil { - return nil, err - } - eventWriter, err = writer.NextInsertEventWriter(int(dim)) - case schemapb.DataType_Float16Vector: - dim, err = typeutil.GetDim(field) - if err != nil { - return nil, err - } - eventWriter, err = writer.NextInsertEventWriter(int(dim)) - case schemapb.DataType_BFloat16Vector: + case schemapb.DataType_FloatVector, + schemapb.DataType_BinaryVector, + schemapb.DataType_Float16Vector, + schemapb.DataType_BFloat16Vector: dim, err = typeutil.GetDim(field) if err != nil { return nil, err @@ -405,7 +390,7 @@ func AddFieldDataToPayload(eventWriter *insertEventWriter, dataType schemapb.Dat default: return fmt.Errorf("undefined data type %d", dataType) } - return fmt.Errorf("undefined data type %d", dataType) + return nil } func (insertCodec *InsertCodec) DeserializeAll(blobs []*Blob) (