Add guards for unsupported subqueries join plan, optimize the possible subqueriese

This comment does not match the query -- from the comment, I expected the replicated table to be in the parent.