@Test
  public void testGetChildNumInEachPipeline() {
    List<PlanNode> allChildren = new ArrayList<>();
    allChildren.add(new ExchangeNode(new PlanNodeId("remoteNode1")));
    allChildren.add(new SeriesScanNode(new PlanNodeId("localNode1"), null));
    allChildren.add(new ExchangeNode(new PlanNodeId("remoteNode2")));
    allChildren.add(new SeriesScanNode(new PlanNodeId("localNode2"), null));

    int[] childNumInEachPipeline =
        operatorTreeGenerator.getChildNumInEachPipeline(allChildren, 2, 2);
    assertEquals(2, childNumInEachPipeline.length);
    assertEquals(2, childNumInEachPipeline[0]);
    assertEquals(1, childNumInEachPipeline[1]);

    allChildren.add(new SeriesScanNode(new PlanNodeId("localNode3"), null));
    allChildren.add(new SeriesScanNode(new PlanNodeId("localNode4"), null));
    allChildren.add(new ExchangeNode(new PlanNodeId("remoteNode3")));
    allChildren.add(new ExchangeNode(new PlanNodeId("remoteNode4")));
    allChildren.add(new SeriesScanNode(new PlanNodeId("localNode5"), null));
    allChildren.add(new ExchangeNode(new PlanNodeId("remoteNode5")));
    childNumInEachPipeline = operatorTreeGenerator.getChildNumInEachPipeline(allChildren, 5, 3);
    assertEquals(3, childNumInEachPipeline.length);
    assertEquals(2, childNumInEachPipeline[0]);
    assertEquals(2, childNumInEachPipeline[1]);
    assertEquals(5, childNumInEachPipeline[2]);
  }
The operator structure is:

<p>DeviceViewOperator - [AggregationOperator1 - [SeriesAggregationScanOperator1,
ExchangeOperator1]], [AggregationOperator2 - [SeriesAggregationScanOperator2,
ExchangeOperator2]].

<p>This test will test dop = 3. Expected result is five pipelines with dependency:

<p>The pipeline0 is: ExchangeOperator - SeriesAggregationScanOperator1.

<p>The pipeline1 is: ExchangeOperator - AggregationOperator1.

<p>The pipeline2 is: ExchangeOperator - SeriesAggregationScanOperator2, which has dependency 1.

<p>The pipeline3 is: ExchangeOperator - AggregationOperator2, which has dependency1.

<p>The pipeline4 is: DeviceView - [ExchangeOperator, ExchangeOperator]
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/PipelineBuilderTest.java