Fix compiling joins containing subqueries, move __repr__ into helper functions