@Test
  public void groupByTimeRawDataTest5() throws Exception {
    int[][] result =
        new int[][] {
          {100, 100, 100, 100, 99, 0},
          {20100, 20199, 10300, 10400, 10499}, // max
          {20001, 10200, 260, 380, 10401}, // min
          {20001, 20101, 10201, 10301, 10401}, // first
          {20100, 10200, 10300, 10400, 10499} // last
        };
    List<TAggregationType> aggregationTypes = new ArrayList<>();
    List<List<InputLocation[]>> inputLocations = new ArrayList<>();
    for (int i = 0; i < 2; i++) {
      aggregationTypes.add(TAggregationType.COUNT);
      aggregationTypes.add(TAggregationType.MAX_VALUE);
      aggregationTypes.add(TAggregationType.MIN_VALUE);
      aggregationTypes.add(TAggregationType.FIRST_VALUE);
      aggregationTypes.add(TAggregationType.LAST_VALUE);
      for (int j = 0; j < 8; j++) {
        List<InputLocation[]> inputLocationForOneAggregator = new ArrayList<>();
        inputLocationForOneAggregator.add(new InputLocation[] {new InputLocation(0, i)});
        inputLocations.add(inputLocationForOneAggregator);
      }
    }
    GroupByTimeParameter groupByTimeParameter =
        new GroupByTimeParameter(0, 600, new TimeDuration(0, 100), new TimeDuration(0, 100), false);

    WindowParameter windowParameter = new TimeWindowParameter(false);
    RawDataAggregationOperator rawDataAggregationOperator =
        initRawDataAggregationOperator(
            aggregationTypes, groupByTimeParameter, inputLocations, windowParameter);
    int count = 0;

    while (rawDataAggregationOperator.isBlocked().isDone()
        && rawDataAggregationOperator.hasNext()) {
      TsBlock resultTsBlock = rawDataAggregationOperator.next();
      if (resultTsBlock == null) {
        continue;
      }
      for (int row = 0; row < resultTsBlock.getPositionCount(); row++, count++) {
        assertEquals(100 * (count + 1), resultTsBlock.getTimeColumn().getLong(row));
        for (int i = 0; i < 2; i++) {
          if (count == 5) {
            assertEquals(result[0][count], resultTsBlock.getColumn(5 * i).getLong(row));
            assertTrue(resultTsBlock.getColumn(5 * i + 1).isNull(row));
            assertTrue(resultTsBlock.getColumn(5 * i + 2).isNull(row));
            assertTrue(resultTsBlock.getColumn(5 * i + 3).isNull(row));
            assertTrue(resultTsBlock.getColumn(5 * i + 4).isNull(row));
            continue;
          }
          assertEquals(result[0][count], resultTsBlock.getColumn(5 * i).getLong(row));
          assertEquals(result[1][count], resultTsBlock.getColumn(5 * i + 1).getInt(row));
          assertEquals(result[2][count], resultTsBlock.getColumn(5 * i + 2).getInt(row));
          assertEquals(result[3][count], resultTsBlock.getColumn(5 * i + 3).getInt(row));
          assertEquals(result[4][count], resultTsBlock.getColumn(5 * i + 4).getInt(row));
        }
      }
    }

    assertEquals(6, count);
  }
test the situation when leftCRightO is false. 1 - 100 101 - 200 201 - 300 301 - 400 401 - 500
501 - 600
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/execution/operator/RawDataAggregationOperatorTest.java