@Override
  public PlanNode optimize(PlanNode plan, PlanOptimizer.Context context) {
    if (!context.getAnalysis().hasSortNode()) {
      return plan;
    }

    return plan.accept(
        new Rewriter(context.getAnalysis(), context.getQueryContext()), new Context());
  }
<b>Optimization phase:</b> Logical plan planning.

<p>This optimize rule implement the rules below.
<li>When the sort order is `IDColumns,Time` or `IDColumns,Others` in SortNode, SortNode can be
    transformed to StreamSortNode.
<li>Set value to `orderByAllIdsAndTime`.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/TransformSortToStreamSort.java