presto-main/src/main/java/io/prestosql/sql/planner/optimizations/ExpressionEquivalence.java/ExpressionEquivalence/visitCall
class ExpressionEquivalence:        @Override
        public RowExpression visitCall(CallExpression call, Void context)
        {
            call = new CallExpression(
                    call.getResolvedFunction(),
                    call.getType(),
                    call.getArguments().stream()
                            .map(expression -> expression.accept(this, context))
                            .collect(toImmutableList()));

            String callName = call.getResolvedFunction().getSignature().getName();

            if (callName.equals(mangleOperatorName(EQUAL)) || callName.equals(mangleOperatorName(NOT_EQUAL)) || callName.equals(mangleOperatorName(IS_DISTINCT_FROM))) {
                // sort arguments
                return new CallExpression(
                        call.getResolvedFunction(),
                        call.getType(),
                        ROW_EXPRESSION_ORDERING.sortedCopy(call.getArguments()));
            }

            if (callName.equals(mangleOperatorName(GREATER_THAN)) || callName.equals(mangleOperatorName(GREATER_THAN_OR_EQUAL))) {
                // convert greater than to less than
                ResolvedFunction newFunction = metadata.resolveOperator(
                        callName.equals(mangleOperatorName(GREATER_THAN)) ? LESS_THAN : LESS_THAN_OR_EQUAL,
                        swapPair(call.getResolvedFunction().getSignature().getArgumentTypes()).stream()
                                .map(metadata::getType)
                                .collect(toImmutableList()));
                return new CallExpression(newFunction, call.getType(), swapPair(call.getArguments()));
            }

            return call;
        }