private OrderByComponent parseOrderByClause(
      IoTDBSqlParser.OrderByClauseContext ctx, ImmutableSet<String> limitSet) {
    OrderByComponent orderByComponent = new OrderByComponent();
    Set<String> sortKeySet = new HashSet<>();
    for (IoTDBSqlParser.OrderByAttributeClauseContext orderByAttributeClauseContext :
        ctx.orderByAttributeClause()) {
      // if the order by clause is unique, then the following sort keys will be ignored
      if (orderByComponent.isUnique()) {
        break;
      }
      SortItem sortItem = parseOrderByAttributeClause(orderByAttributeClauseContext, limitSet);

      String sortKey = sortItem.getSortKey();
      if (sortKeySet.contains(sortKey)) {
        continue;
      } else {
        sortKeySet.add(sortKey);
      }

      if (sortItem.isExpression()) {
        orderByComponent.addExpressionSortItem(sortItem);
      } else {
        orderByComponent.addSortItem(sortItem);
      }
    }
    return orderByComponent;
  }
Parse time range (startTime and endTime) in group by time.

@throws SemanticException if startTime is larger or equals to endTime in timeRange
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/parser/ASTVisitor.java