@Override
  public List<WritePlanNode> splitByPartition(IAnalysis analysis) {
    List<WritePlanNode> result = new ArrayList<>();

    Map<TRegionReplicaSet, Map<TTimePartitionSlot, List<InsertRowNode>>> splitMap = new HashMap<>();
    Map<TRegionReplicaSet, Map<TTimePartitionSlot, List<Integer>>> splitMapForIndex =
        new HashMap<>();

    for (int i = 0; i < insertRowNodeList.size(); i++) {
      InsertRowNode insertRowNode = insertRowNodeList.get(i);
      TTimePartitionSlot timePartitionSlot =
          TimePartitionUtils.getTimePartitionSlot(insertRowNode.getTime());
      TRegionReplicaSet dataRegionReplicaSet =
          analysis
              .getDataPartitionInfo()
              .getDataRegionReplicaSetForWriting(
                  targetPath.getIDeviceIDAsFullDevice(),
                  timePartitionSlot,
                  analysis.getDatabaseName());
      Map<TTimePartitionSlot, List<InsertRowNode>> tmpMap =
          splitMap.computeIfAbsent(dataRegionReplicaSet, k -> new HashMap<>());
      Map<TTimePartitionSlot, List<Integer>> tmpIndexMap =
          splitMapForIndex.computeIfAbsent(dataRegionReplicaSet, k -> new HashMap<>());
      List<InsertRowNode> tmpList =
          tmpMap.computeIfAbsent(timePartitionSlot, k -> new ArrayList<>());
      List<Integer> tmpIndexList =
          tmpIndexMap.computeIfAbsent(timePartitionSlot, k -> new ArrayList<>());
      tmpList.add(insertRowNode);
      tmpIndexList.add(insertRowNodeIndexList.get(i));

      if (i == insertRowNodeList.size() - 1) {
        analysis.setRedirectNodeList(
            Collections.singletonList(
                dataRegionReplicaSet.getDataNodeLocations().get(0).getClientRpcEndPoint()));
      }
    }

    for (Map.Entry<TRegionReplicaSet, Map<TTimePartitionSlot, List<InsertRowNode>>> entry1 :
        splitMap.entrySet()) {
      for (Map.Entry<TTimePartitionSlot, List<InsertRowNode>> entry :
          entry1.getValue().entrySet()) {
        InsertRowsOfOneDeviceNode reducedNode = new InsertRowsOfOneDeviceNode(this.getPlanNodeId());
        reducedNode.setInsertRowNodeList(entry.getValue());
        reducedNode.setInsertRowNodeIndexList(
            splitMapForIndex.get(entry1.getKey()).get(entry.getKey()));
        reducedNode.setDataRegionReplicaSet(entry1.getKey());
        result.add(reducedNode);
      }
    }
    return result;
  }
record the result of insert rows
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/node/write/InsertRowsOfOneDeviceNode.java