presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/SimplifyExpressions.java/SimplifyExpressions/rewrite
class SimplifyExpressions:    @VisibleForTesting
    static Expression rewrite(Expression expression, Session session, SymbolAllocator symbolAllocator, Metadata metadata, LiteralEncoder literalEncoder, TypeAnalyzer typeAnalyzer)
    {
        requireNonNull(metadata, "metadata is null");
        requireNonNull(typeAnalyzer, "typeAnalyzer is null");
        if (expression instanceof SymbolReference) {
            return expression;
        }
        expression = pushDownNegations(metadata, expression);
        expression = extractCommonPredicates(metadata, expression);
        Map<NodeRef<Expression>, Type> expressionTypes = typeAnalyzer.getTypes(session, symbolAllocator.getTypes(), expression);
        ExpressionInterpreter interpreter = ExpressionInterpreter.expressionOptimizer(expression, metadata, session, expressionTypes);
        Object optimized = interpreter.optimize(NoOpSymbolResolver.INSTANCE);
        return literalEncoder.toExpression(optimized, expressionTypes.get(NodeRef.of(expression)));
    }