diff --git a/pkg/container/batch/batch.go b/pkg/container/batch/batch.go index 041820f6f6698247b3b8eb9ab9da9a189dfebd38..7d87a388ed245deb58ef4c6ef03cf3876a1fb7cb 100644 --- a/pkg/container/batch/batch.go +++ b/pkg/container/batch/batch.go @@ -75,7 +75,11 @@ func NewWithSize(n int) *Batch { } func (bat *Batch) MarshalBinary() ([]byte, error) { - return types.Encode(&EncodeBatch{Zs: bat.Zs, Vecs: bat.Vecs}) + return types.Encode(&EncodeBatch{ + Zs: bat.Zs, + Vecs: bat.Vecs, + Attrs: bat.Attrs, + }) } func (bat *Batch) UnmarshalBinary(data []byte) error { @@ -86,6 +90,7 @@ func (bat *Batch) UnmarshalBinary(data []byte) error { bat.Cnt = 1 bat.Zs = rbat.Zs bat.Vecs = rbat.Vecs + bat.Attrs = rbat.Attrs return nil } diff --git a/pkg/container/batch/types.go b/pkg/container/batch/types.go index cfc142adb3840ca6378616d17c04e034fb46041d..89e38f94a98cf552456932014d6047810909aeac 100644 --- a/pkg/container/batch/types.go +++ b/pkg/container/batch/types.go @@ -20,8 +20,9 @@ import ( ) type EncodeBatch struct { - Zs []int64 - Vecs []*vector.Vector + Zs []int64 + Vecs []*vector.Vector + Attrs []string } // Batch represents a part of a relationship diff --git a/pkg/container/vector/vector.go b/pkg/container/vector/vector.go index ca81f634a1f7bc875e4e044328cac58544406341..c17cb36f41230290cc2445d6a950b0976ec2a980 100644 --- a/pkg/container/vector/vector.go +++ b/pkg/container/vector/vector.go @@ -4435,6 +4435,9 @@ func (v *Vector) Read(data []byte) error { v.Col = types.DecodeTimestampSlice(data[size:]) } case types.T_char, types.T_varchar, types.T_json, types.T_blob: + if v.Col == nil { + v.Col = &types.Bytes{} + } Col := v.Col.(*types.Bytes) Col.Reset() size := types.DecodeUint32(data)