code: func GetCompareFunc(tp *types.FieldType) CompareFunc {
  	switch tp.Tp {
  	case mysql.TypeTiny, mysql.TypeShort, mysql.TypeInt24, mysql.TypeLong, mysql.TypeLonglong, mysql.TypeYear:
  		if mysql.HasUnsignedFlag(tp.Flag) {
  			return cmpUint64
  		}
  		return cmpInt64
  	case mysql.TypeFloat:
  		return cmpFloat32
  	case mysql.TypeDouble:
  		return cmpFloat64
  	case mysql.TypeString, mysql.TypeVarString, mysql.TypeVarchar,
  		mysql.TypeBlob, mysql.TypeTinyBlob, mysql.TypeMediumBlob, mysql.TypeLongBlob:
  		return cmpString
  	case mysql.TypeDate, mysql.TypeDatetime, mysql.TypeTimestamp:
  		return cmpTime
  	case mysql.TypeDuration:
  		return cmpDuration
  	case mysql.TypeNewDecimal:
  		return cmpMyDecimal
  	case mysql.TypeSet, mysql.TypeEnum:
  		return cmpNameValue
  	case mysql.TypeBit:
  		return cmpBit
  	case mysql.TypeJSON:
  		return cmpJSON
  	}
  	return nil
  }
docs: // GetCompareFunc gets a compare function for the field type.