join optimizer and query tests are passing