Description
At initialPlan we may remove some Spark Plan with queryStagePreparationRules, if removed Spark Plan is top level node, then we will lose the linked logical node.
Since we support AQE side broadcast join config. It's more common that a join is SMJ at normal planner and changed to BHJ after AQE reOptimize. However, RemoveRedundantSorts is applied before reOptimize at initialPlan, then a local sort might be removed incorrectly if a join is SMJ at first but changed to BHJ during reOptimize.