internal SqlUnary Unary(SqlNodeType nodeType, SqlExpression expression, MethodInfo method, Expression sourceExpression)
        {
            Type         clrType = null;
            ProviderType sqlType = null;

            if (nodeType == SqlNodeType.Count)
            {
                clrType = typeof(int);
                sqlType = typeProvider.From(typeof(int));
            }
            else if (nodeType == SqlNodeType.LongCount)
            {
                clrType = typeof(long);
                sqlType = typeProvider.From(typeof(long));
            }
            else if (nodeType == SqlNodeType.ClrLength)
            {
                clrType = typeof(int);
                sqlType = typeProvider.From(typeof(int));
            }
            else
            {
                if (nodeType.IsPredicateUnaryOperator())
                {
                    // DevDiv 201730 - Do not ignore nullability of bool type
                    clrType = expression.ClrType.Equals(typeof(bool?)) ? typeof(bool?) : typeof(bool);
                }
                else
                {
                    clrType = expression.ClrType;
                }
                sqlType = typeProvider.PredictTypeForUnary(nodeType, expression.SqlType);
            }

            return(new SqlUnary(nodeType, clrType, sqlType, expression, method, sourceExpression));
        }