@Override
    public int size() {
      if (isDistinct) {
        Iterator<E> iter = iterator();
        int count = 0;
        while (iter.hasNext()) {
          ++count;
          iter.next();
        }
        return count;

      } else {
        int totalSize = 0;
        for (Collection<E> result : sortedResults) {
          totalSize += result.size();
        }
        if (limit >= 0) {
          return totalSize > limit ? limit : totalSize;
        } else {
          return totalSize;
        }
      }

    }
The n - way merge results returns a sorted results on the cumulative sorted results for
partitioned region based query
geode-core/src/main/java/org/apache/geode/cache/query/internal/NWayMergeResults.java