@Test
  public void testGroupByIntermediateResult1() throws Exception {
    int[][] result =
        new int[][] {
          {100, 100, 100, 99},
          {2004950, 2014950, 624950, 834551},
          {0, 100, 200, 300},
          {99, 199, 299, 398},
          {20099, 20199, 10259, 10379},
          {20000, 20100, 260, 380}
        };
    GroupByTimeParameter groupByTimeParameter =
        new GroupByTimeParameter(0, 399, new TimeDuration(0, 100), new TimeDuration(0, 100), true);

    List<TAggregationType> aggregationTypes = new ArrayList<>();
    aggregationTypes.add(TAggregationType.COUNT);
    aggregationTypes.add(TAggregationType.SUM);
    aggregationTypes.add(TAggregationType.MIN_TIME);
    aggregationTypes.add(TAggregationType.MAX_TIME);
    aggregationTypes.add(TAggregationType.MAX_VALUE);
    aggregationTypes.add(TAggregationType.MIN_VALUE);

    List<List<InputLocation[]>> inputLocations = new ArrayList<>();
    for (int i = 0; i < aggregationTypes.size(); i++) {
      List<InputLocation[]> inputLocationForOneAggregator = new ArrayList<>();
      inputLocationForOneAggregator.add(new InputLocation[] {new InputLocation(0, i)});
      inputLocationForOneAggregator.add(new InputLocation[] {new InputLocation(1, i)});
      inputLocations.add(inputLocationForOneAggregator);
    }

    AggregationOperator aggregationOperator =
        initAggregationOperator(aggregationTypes, groupByTimeParameter, inputLocations);
    int count = 0;
    while (true) {
      ListenableFuture<?> blocked = aggregationOperator.isBlocked();
      blocked.get();
      if (!aggregationOperator.hasNext()) {
        break;
      }
      TsBlock resultTsBlock = aggregationOperator.next();
      if (resultTsBlock == null) {
        continue;
      }
      int positionCount = resultTsBlock.getPositionCount();
      for (int pos = 0; pos < positionCount; pos++) {
        assertEquals(100 * count, resultTsBlock.getTimeColumn().getLong(pos));
        assertEquals(result[0][count], resultTsBlock.getColumn(0).getLong(pos));
        assertEquals(result[1][count], resultTsBlock.getColumn(1).getDouble(pos), 0.0001);
        assertEquals(result[2][count], resultTsBlock.getColumn(2).getLong(pos));
        assertEquals(result[3][count], resultTsBlock.getColumn(3).getLong(pos));
        assertEquals(result[4][count], resultTsBlock.getColumn(4).getInt(pos));
        assertEquals(result[5][count], resultTsBlock.getColumn(5).getInt(pos));
        count++;
      }
    }
    assertEquals(4, count);
  }
Try to aggregate binary intermediate result of one time series without group by interval.
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/AggregationOperatorTest.java