private TRegionReplicaSet getNodeRegion(
      PlanNode root, final Map<PlanNodeId, NodeDistribution> nodeDistributionMap) {
    if (nodeDistributionMap.containsKey(root.getPlanNodeId())) {
      return nodeDistributionMap.get(root.getPlanNodeId()).getRegion();
    } else if (root instanceof IPartitionRelatedNode) {
      return ((IPartitionRelatedNode) root).getRegionReplicaSet();
    }
    for (PlanNode child : root.getChildren()) {
      TRegionReplicaSet result = getNodeRegion(child, nodeDistributionMap);
      if (result != null && result != DataPartition.NOT_ASSIGNED) {
        return result;
      }
    }
    return null;
  }
PlanFragment contains a sub-query of distributed query.
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/planner/plan/PlanFragment.java