MCPcopy Create free account
hub / github.com/pingcap/tidb / tryDecodeHandle

Method tryDecodeHandle

pkg/util/rowcodec/decoder.go:448–479  ·  view source on GitHub ↗
(values [][]byte, offset int, col *ColInfo,
	handle kv.Handle, cacheBytes []byte)

Source from the content-addressed store, hash-verified

446}
447
448func (decoder *BytesDecoder) tryDecodeHandle(values [][]byte, offset int, col *ColInfo,
449 handle kv.Handle, cacheBytes []byte) bool {
450 if handle == nil {
451 return false
452 }
453 if types.NeedRestoredData(col.Ft) {
454 return false
455 }
456 if col.IsPKHandle || col.ID == model.ExtraHandleID {
457 handleData := cacheBytes
458 if mysql.HasUnsignedFlag(col.Ft.GetFlag()) {
459 handleData = append(handleData, UintFlag)
460 handleData = codec.EncodeUint(handleData, uint64(handle.IntValue()))
461 } else {
462 handleData = append(handleData, IntFlag)
463 handleData = codec.EncodeInt(handleData, handle.IntValue())
464 }
465 values[offset] = handleData
466 return true
467 }
468 var handleData []byte
469 for i, hid := range decoder.handleColIDs {
470 if col.ID == hid {
471 handleData = append(handleData, handle.EncodedCol(i)...)
472 }
473 }
474 if len(handleData) > 0 {
475 values[offset] = handleData
476 return true
477 }
478 return false
479}
480
481// DecodeToBytesNoHandle decodes raw byte slice to row data without handle.
482func (decoder *BytesDecoder) DecodeToBytesNoHandle(outputOffset map[int64]int, value []byte) ([][]byte, error) {

Callers 1

decodeToBytesInternalMethod · 0.95

Calls 7

NeedRestoredDataFunction · 0.92
HasUnsignedFlagFunction · 0.92
EncodeUintFunction · 0.92
EncodeIntFunction · 0.92
GetFlagMethod · 0.65
IntValueMethod · 0.65
EncodedColMethod · 0.65

Tested by

no test coverage detected