@Test
  public void testIdentitySinkNodeMemoryEstimatorWithDop2() throws IllegalPathException {
    TypeProvider typeProvider = new TypeProvider();
    IdentitySinkNode identitySinkNode = initIdentitySinkNode(typeProvider);
    LocalExecutionPlanContext context =
        createLocalExecutionPlanContextWithQueryId(typeProvider, new QueryId("test_dop2"));
    context.setDegreeOfParallelism(2);

    // Validate PipelineMemoryEstimator
    try (Operator root = identitySinkNode.accept(operatorTreeGenerator, context)) {
      PipelineMemoryEstimator rootPipelineMemoryEstimator =
          context.constructPipelineMemoryEstimator(root, null, identitySinkNode, -1);
      assertEquals(
          ConsumeChildrenOneByOnePipelineMemoryEstimator.class,
          rootPipelineMemoryEstimator.getClass());
      assertEquals(
          root.calculateMaxPeekMemoryWithCounter()
              + rootPipelineMemoryEstimator.getChildren().stream()
                      .map(PipelineMemoryEstimator::calculateEstimatedRunningMemorySize)
                      .reduce(0L, Long::sum)
                  / 3,
          rootPipelineMemoryEstimator.calculateEstimatedRunningMemorySize());

      List<PipelineMemoryEstimator> childrenPipelineMemoryEstimators =
          rootPipelineMemoryEstimator.getChildren();
      assertEquals(3, childrenPipelineMemoryEstimators.size());
      for (int i = 0; i < 3; i++) {
        assertEquals(
            ConsumeAllChildrenPipelineMemoryEstimator.class,
            childrenPipelineMemoryEstimators.get(i).getClass());
        assertEquals(
            FullOuterTimeJoinOperator.class,
            childrenPipelineMemoryEstimators.get(i).getRoot().getClass());
        assertEquals(0, childrenPipelineMemoryEstimators.get(i).getChildren().size());
      }
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
The operator structure is:

<p>IdentitySinkOperator - [ExchangeOperator1, ExchangeOperator2, ExchangeOperator3]

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

<p>The pipeline0 is: ExchangeOperator1 - FullOuterTimeJoinOperator1.

<p>The pipeline1 is: ExchangeOperator2 - FullOuterTimeJoinOperator2, which has dependency 0.

<p>The pipeline2 is: ExchangeOperator2 - FullOuterTimeJoinOperator2, which has dependency 1.

<p>The pipeline3 is: IdentitySinkOperator - [ExchangeOperator1, ExchangeOperator2,
ExchangeOperator3]
iotdb-core/datanode/src/test/java/org/apache/iotdb/db/queryengine/plan/planner/PipelineBuilderTest.java