private Map<InternalDistributedMember, List<Integer>> buildNodeToBucketMapForBuckets(
      final Set<Integer> bucketIdsToConsider) throws QueryException {
    final HashMap<InternalDistributedMember, List<Integer>> ret = new HashMap<>();
    if (bucketIdsToConsider.isEmpty()) {
      return ret;
    }
    List<Integer> bucketIds;
    if (query != null && query.isCqQuery()) {
      bucketIds = findPrimaryBucketOwners(bucketIdsToConsider, ret);
    } else {
      bucketIds = findBucketOwners(bucketIdsToConsider, ret);
    }
    if (bucketIds.size() != bucketIdsToConsider.size()) {
      bucketIdsToConsider.removeAll(bucketIds);
      throw new QueryException("Data loss detected, unable to find the hosting "
          + " node for some of the dataset. [dataset/bucket ids:" + bucketIdsToConsider + "]");
    }
    if (logger.isDebugEnabled()) {
      logger.debug("Node to bucketId map: {}", ret);
    }
    return ret;
  }
@return Map of {@link InternalDistributedMember} to {@link ArrayList} of Integers
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionQueryEvaluator.java