Skip to content

Commit

Permalink
improve util
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 committed Mar 30, 2022
1 parent 63f7033 commit 92b1764
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions util/rowcodec/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -464,28 +464,22 @@ func (decoder *BytesDecoder) DecodeToBytes(outputOffset map[int64]int, handle kv
}

func (decoder *BytesDecoder) encodeOldDatum(tp byte, val []byte) []byte {
buf := make([]byte, 0, 1+binary.MaxVarintLen64+len(val))
switch tp {
case BytesFlag:
buf := make([]byte, 0, 1+binary.MaxVarintLen64+len(val))
buf = append(buf, CompactBytesFlag)
buf = codec.EncodeCompactBytes(buf, val)
return buf
case IntFlag:
buf := make([]byte, 0, 1+binary.MaxVarintLen64)
buf = append(buf, VarintFlag)
buf = codec.EncodeVarint(buf, decodeInt(val))
return buf
case UintFlag:
buf := make([]byte, 0, 1+binary.MaxVarintLen64)
buf = append(buf, VaruintFlag)
buf = codec.EncodeUvarint(buf, decodeUint(val))
return buf
default:
buf := make([]byte, 0, 1+len(val))
buf = append(buf, tp)
buf = append(buf, val...)
return buf
}
return buf
}

// fieldType2Flag transforms field type into kv type flag.
Expand Down

0 comments on commit 92b1764

Please sign in to comment.