code: func CompareInt(sctx sessionctx.Context, lhsArg, rhsArg Expression, lhsRow, rhsRow chunk.Row) (int64, bool, error) {
  	arg0, isNull0, err := lhsArg.EvalInt(sctx, lhsRow)
  	if err != nil {
  		return 0, true, err
  	}
  
  	arg1, isNull1, err := rhsArg.EvalInt(sctx, rhsRow)
  	if err != nil {
  		return 0, true, err
  	}
  
  	// compare null values.
  	if isNull0 || isNull1 {
  		return compareNull(isNull0, isNull1), true, nil
  	}
  
  	isUnsigned0, isUnsigned1 := mysql.HasUnsignedFlag(lhsArg.GetType().Flag), mysql.HasUnsignedFlag(rhsArg.GetType().Flag)
  	var res int
  	switch {
  	case isUnsigned0 && isUnsigned1:
  		res = types.CompareUint64(uint64(arg0), uint64(arg1))
  	case isUnsigned0 && !isUnsigned1:
  		if arg1 < 0 || uint64(arg0) > math.MaxInt64 {
  			res = 1
  		} else {
  			res = types.CompareInt64(arg0, arg1)
  		}
  	case !isUnsigned0 && isUnsigned1:
  		if arg0 < 0 || uint64(arg1) > math.MaxInt64 {
  			res = -1
  		} else {
  			res = types.CompareInt64(arg0, arg1)
  		}
  	case !isUnsigned0 && !isUnsigned1:
  		res = types.CompareInt64(arg0, arg1)
  	}
  	return int64(res), false, nil
  }
docs: // CompareInt compares two integers.