@Override
    public PlanNode visitStreamSort(StreamSortNode node, Context context) {
      Context newContext = new Context();
      PlanNode child = node.getChild().accept(this, newContext);
      context.setHasSeenFill(newContext.hasSeenFill);
      return !context.hasSeenFill()
              && (node.isOrderByAllIdsAndTime()
                  || node.getStreamCompareKeyEndIndex()
                      == node.getOrderingScheme().getOrderBy().size() - 1)
          ? child
          : node.replaceChildren(Collections.singletonList(child));
    }
<b>Optimization phase:</b> Distributed plan planning.

<p>This optimize rule implement the rules below.
<li>When order by time and there is only one device entry in DeviceTableScanNode below, the
    SortNode can be eliminated.
<li>When order by all IDColumns and time, the SortNode can be eliminated.
<li>When StreamSortIndex==OrderBy size()-1, remove this StreamSortNode
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/planner/optimizations/SortElimination.java