@Override
    public Set<RelationalPath<?>> visit(SubQueryExpression<?> expr, Set<RelationalPath<?>> known) {
        Set<RelationalPath<?>> old = known;
        final QueryMetadata md = expr.getMetadata();
        known = visitJoins(md.getJoins(), known);
        if (md.getProjection() != null) {
            known = md.getProjection().accept(this, known);
        }
        for (OrderSpecifier<?> o : md.getOrderBy()) {
            known = o.getTarget().accept(this, known);
        }
        for (Expression<?> g : md.getGroupBy()) {
            known = g.accept(this, known);
        }
        if (md.getHaving() != null) {
            known = md.getHaving().accept(this, known);
        }
        if (md.getWhere() != null) {
            md.getWhere().accept(this, known);
        }
        return old;
    }
{@code RelationalPathExtractor} extracts {@link RelationalPath} instances from expressions and queries

@author tiwe
querydsl-sql/src/main/java/com/querydsl/sql/RelationalPathExtractor.java