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

hasPartitionTableJoined is hard to read. maybe rename to hasPartitionedTableJoin