code: func getBaseCmpType(lhs, rhs types.EvalType, lft, rft *types.FieldType) types.EvalType {
  	if lft.Tp == mysql.TypeUnspecified || rft.Tp == mysql.TypeUnspecified {
  		if lft.Tp == rft.Tp {
  			return types.ETString
  		}
  		if lft.Tp == mysql.TypeUnspecified {
  			lhs = rhs
  		} else {
  			rhs = lhs
  		}
  	}
  	if lhs.IsStringKind() && rhs.IsStringKind() {
  		return types.ETString
  	} else if (lhs == types.ETInt || lft.Hybrid()) && (rhs == types.ETInt || rft.Hybrid()) {
  		return types.ETInt
  	} else if ((lhs == types.ETInt || lft.Hybrid()) || lhs == types.ETDecimal) &&
  		((rhs == types.ETInt || rft.Hybrid()) || rhs == types.ETDecimal) {
  		return types.ETDecimal
  	}
  	return types.ETReal
  }
docs: // getBaseCmpType gets the EvalType that the two args will be treated as when comparing.