presto-main/src/main/java/io/prestosql/execution/scheduler/TopologyAwareNodeSelector.java/TopologyAwareNodeSelector/bestNodeSplitCount
class TopologyAwareNodeSelector:    @Nullable
    private InternalNode bestNodeSplitCount(Iterator<InternalNode> candidates, int minCandidatesWhenFull, int maxPendingSplitsPerTask, NodeAssignmentStats assignmentStats)
    {
        InternalNode bestQueueNotFull = null;
        int min = Integer.MAX_VALUE;
        int fullCandidatesConsidered = 0;

        while (candidates.hasNext() && (fullCandidatesConsidered < minCandidatesWhenFull || bestQueueNotFull == null)) {
            InternalNode node = candidates.next();
            if (assignmentStats.getTotalSplitCount(node) < maxSplitsPerNode) {
                return node;
            }
            fullCandidatesConsidered++;
            int totalSplitCount = assignmentStats.getQueuedSplitCountForStage(node);
            if (totalSplitCount < min && totalSplitCount < maxPendingSplitsPerTask) {
                min = totalSplitCount;
                bestQueueNotFull = node;
            }
        }
        return bestQueueNotFull;
    }