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

Function buildRestoredColumn

pkg/tablecodec/tablecodec.go:913–935  ·  view source on GitHub ↗
(allCols []rowcodec.ColInfo)

Source from the content-addressed store, hash-verified

911}
912
913func buildRestoredColumn(allCols []rowcodec.ColInfo) []rowcodec.ColInfo {
914 restoredColumns := make([]rowcodec.ColInfo, 0, len(allCols))
915 for i, col := range allCols {
916 if !types.NeedRestoredData(col.Ft) {
917 continue
918 }
919 copyColInfo := rowcodec.ColInfo{
920 ID: col.ID,
921 }
922 if collate.IsBinCollation(col.Ft.GetCollate()) {
923 // Change the fieldType from string to uint since we store the number of the truncated spaces.
924 // NOTE: the corresponding datum is generated as `types.NewUintDatum(paddingSize)`, and the raw data is
925 // encoded via `encodeUint`. Thus we should mark the field type as unsigened here so that the BytesDecoder
926 // can decode it correctly later. Otherwise there might be issues like #47115.
927 copyColInfo.Ft = types.NewFieldType(mysql.TypeLonglong)
928 copyColInfo.Ft.AddFlag(mysql.UnsignedFlag)
929 } else {
930 copyColInfo.Ft = allCols[i].Ft
931 }
932 restoredColumns = append(restoredColumns, copyColInfo)
933 }
934 return restoredColumns
935}
936
937func decodeIndexKvOldCollation(key, value []byte, hdStatus HandleStatus, buf []byte, resultValues [][]byte) ([][]byte, error) {
938 b, err := CutIndexKeyTo(key, resultValues)

Callers 1

decodeRestoredValuesV5Function · 0.85

Calls 5

NeedRestoredDataFunction · 0.92
IsBinCollationFunction · 0.92
NewFieldTypeFunction · 0.92
GetCollateMethod · 0.45
AddFlagMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…