@Override public Iterator<GTRecord> iterator() { Iterator<PartitionResultIterator> iterators = Iterators.transform(blocks, new Function<byte[], PartitionResultIterator>() { public PartitionResultIterator apply(byte[] input) { return new PartitionResultIterator(input, info, columns); } }); if (!needSorted) { logger.debug("Using Iterators.concat to pipeline partition results"); return Iterators.concat(iterators); } return new SortMergedPartitionResultIterator(iterators, info, GTRecord.getComparator(groupByDims)); } }
@Override public GTRecord next() { if (!hasNext()) { throw new NoSuchElementException(); } // get smallest record PeekingIterator<GTRecord> it = heap.poll(); // WATCH OUT! record got from PartitionResultIterator.next() may changed later, // so we must make a shallow copy of it. record.shallowCopyFrom(it.next()); if (it.hasNext()) { heap.offer(it); } return record; } }
@Override public Iterator<GTRecord> iterator() { Iterator<PartitionResultIterator> iterators = Iterators.transform(blocks, new Function<byte[], PartitionResultIterator>() { public PartitionResultIterator apply(byte[] input) { return new PartitionResultIterator(input, info, columns); } }); if (!needSorted) { logger.debug("Using Iterators.concat to pipeline partition results"); return Iterators.concat(iterators); } return new SortMergedPartitionResultIterator(iterators, info, GTRecord.getComparator(groupByDims)); } }
@Override public GTRecord next() { if (!hasNext()) { throw new NoSuchElementException(); } // get smallest record PeekingIterator<GTRecord> it = heap.poll(); // WATCH OUT! record got from PartitionResultIterator.next() may changed later, // so we must make a shallow copy of it. record.shallowCopyFrom(it.next()); if (it.hasNext()) { heap.offer(it); } return record; } }