static void pickNodes(Collection<ClickHouseNode> source, ClickHouseNodeSelector selector,
            Set<ClickHouseNode> target, int groupSize, long currentTime) {
        boolean hasSelector = selector != null && selector != ClickHouseNodeSelector.EMPTY;
        int count = target.size();
        for (ClickHouseNode node : source) {
            if (!hasSelector || selector.match(node)) {
                int interval = node.config.getNodeCheckInterval();
                if (interval < 1 || (currentTime - node.lastUpdateTime.get()) >= interval) {
                    target.add(node);
                    count++;
                }
            }
            if (groupSize > 0 && count >= groupSize) {
                break;
            }
        }
    }
Picks node from {@code source} and put into {@code target}.

@param source      list of nodes to pick
@param selector    node selector for filtering out nodes
@param target      container for selected nodes
@param groupSize   maximum number of nodes allowed
@param currentTime current timestamp for filtering
clickhouse-client/src/main/java/com/clickhouse/client/ClickHouseNodes.java