public PlanNode cloneWithChildren(List<PlanNode> children) {
    if (!(children == null
        || allowedChildCount() == CHILD_COUNT_NO_LIMIT
        || children.size() == allowedChildCount())) {
      throw new IllegalArgumentException(
          String.format(
              "Child count is not correct for PlanNode. Expected: %d, Value: %d",
              allowedChildCount(), getChildrenCount(children)));
    }
    PlanNode node = clone();
    if (children != null) {
      children.forEach(node::addChild);
    }
    return node;
  }
Create sub node which has exactly the same function of origin node, only its children is a part
of it, which is composed by the [startIndex, endIndex) of origin children list.

@param subNodeId the sub node id
@param startIndex the start Index of origin children
@param endIndex the endIndex Index of origin children
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/PlanNode.java