public static boolean isOrderByAllIdsAndTime(
      Map<Symbol, ColumnSchema> tableColumnSchema,
      OrderingScheme orderingScheme,
      int streamSortIndex) {
    for (Map.Entry<Symbol, ColumnSchema> entry : tableColumnSchema.entrySet()) {
      if (entry.getValue().getColumnCategory() == TsTableColumnCategory.TAG
          && !orderingScheme.getOrderings().containsKey(entry.getKey())) {
        return false;
      }
    }
    return orderingScheme.getOrderings().size() == streamSortIndex + 1
        || isTimeColumn(orderingScheme.getOrderBy().get(streamSortIndex + 1), tableColumnSchema);
  }
<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