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

You can just set m_JoinValid directly as you go -- you don't need this temp local variable.