private TDataNodeLocation getNodeLocation(PlanNode root) {
    if (root instanceof VirtualSourceNode) {
      return ((VirtualSourceNode) root).getDataNodeLocation();
    } else if (root instanceof InformationSchemaTableScanNode) {
      TRegionReplicaSet regionReplicaSet =
          ((InformationSchemaTableScanNode) root).getRegionReplicaSet();

      checkArgument(
          regionReplicaSet != null, "InformationSchemaTableScanNode must have regionReplicaSet");
      checkArgument(
          regionReplicaSet.getDataNodeLocations().size() == 1,
          "each InformationSchemaTableScanNode have only one DataNodeLocation");

      return regionReplicaSet.getDataNodeLocations().get(0);
    }
    for (PlanNode child : root.getChildren()) {
      TDataNodeLocation result = getNodeLocation(child);
      if (result != null) {
        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