presto-main/src/main/java/io/prestosql/sql/planner/SubExpressionExtractor.java/SubExpressionExtractor/extract
class SubExpressionExtractor:    public static Set<Expression> extract(Expression expression)
    {
        return AstUtils.preOrder(expression)
                .map(Expression.class::cast)
                .collect(ImmutableSet.toImmutableSet());
    }