private static List<List<TTimePartitionSlot>> combineTwoTimePartitionList(
      List<List<TTimePartitionSlot>> left, List<List<TTimePartitionSlot>> right) {
    int leftIndex = 0;
    int leftSize = left.size();
    int rightIndex = 0;
    int rightSize = right.size();

    List<List<TTimePartitionSlot>> res = new ArrayList<>(Math.max(leftSize, rightSize));

    int previousResIndex = 0;
    res.add(new ArrayList<>());
    int leftCurrentListIndex = 0;
    int rightCurrentListIndex = 0;
    while (leftIndex < leftSize && rightIndex < rightSize) {
      List<TTimePartitionSlot> leftCurrentList = left.get(leftIndex);
      List<TTimePartitionSlot> rightCurrentList = right.get(rightIndex);
      int leftCurrentListSize = leftCurrentList.size();
      int rightCurrentListSize = rightCurrentList.size();
      while (leftCurrentListIndex < leftCurrentListSize
          && rightCurrentListIndex < rightCurrentListSize) {
        // only keep time partition in All SeriesSlot
        if (leftCurrentList.get(leftCurrentListIndex).startTime
            == rightCurrentList.get(rightCurrentListIndex).startTime) {
          // new continuous time range
          if ((leftCurrentListIndex == 0 && leftIndex != 0)
              || (rightCurrentListIndex == 0 && rightIndex != 0)) {
            previousResIndex++;
            res.add(new ArrayList<>());
          }
          res.get(previousResIndex).add(leftCurrentList.get(leftCurrentListIndex));
          leftCurrentListIndex++;
          rightCurrentListIndex++;
        } else if (leftCurrentList.get(leftCurrentListIndex).startTime
            < rightCurrentList.get(rightCurrentListIndex).startTime) {
          leftCurrentListIndex++;
        } else {
          rightCurrentListIndex++;
        }
      }
      if (leftCurrentListIndex == leftCurrentListSize) {
        leftIndex++;
        leftCurrentListIndex = 0;
      }
      if (rightCurrentListIndex == rightCurrentListSize) {
        rightIndex++;
        rightCurrentListIndex = 0;
      }
    }
    return res;
  }
aggregation align by device, and aggregation is `count_if` or `diff`, or aggregation used with
group by parameter (session, variation, count), use the old aggregation logic
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/distribution/SourceRewriter.java