code: func DecodeRowWithMap(b []byte, cols map[int64]*types.FieldType, loc *time.Location, row map[int64]types.Datum) (map[int64]types.Datum, error) {
  	if row == nil {
  		row = make(map[int64]types.Datum, len(cols))
  	}
  	if b == nil {
  		return row, nil
  	}
  	if len(b) == 1 && b[0] == codec.NilFlag {
  		return row, nil
  	}
  	cnt := 0
  	var (
  		data []byte
  		err  error
  	)
  	for len(b) > 0 {
  		// Get col id.
  		data, b, err = codec.CutOne(b)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		_, cid, err := codec.DecodeOne(data)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		// Get col value.
  		data, b, err = codec.CutOne(b)
  		if err != nil {
  			return nil, errors.Trace(err)
  		}
  		id := cid.GetInt64()
  		ft, ok := cols[id]
  		if ok {
  			_, v, err := codec.DecodeOne(data)
  			if err != nil {
  				return nil, errors.Trace(err)
  			}
  			v, err = unflatten(v, ft, loc)
  			if err != nil {
  				return nil, errors.Trace(err)
  			}
  			row[id] = v
  			cnt++
  			if cnt == len(cols) {
  				// Get enough data.
  				break
  			}
  		}
  	}
  	return row, nil
  }
docs: // DecodeRowWithMap decodes a byte slice into datums with a existing row map.
  // Row layout: colID1, value1, colID2, value2, .....