Search in sources :

Example 1 with UnionResultIterators

use of org.apache.phoenix.iterate.UnionResultIterators in project phoenix by apache.

the class UnionPlan method iterator.

@Override
public final ResultIterator iterator(ParallelScanGrouper scanGrouper, Scan scan) throws SQLException {
    this.iterators = new UnionResultIterators(plans, parentContext);
    ResultIterator scanner;
    boolean isOrdered = !orderBy.getOrderByExpressions().isEmpty();
    if (isOrdered) {
        // TopN
        scanner = new MergeSortTopNResultIterator(iterators, limit, offset, orderBy.getOrderByExpressions());
    } else {
        scanner = new ConcatResultIterator(iterators);
        if (offset != null) {
            scanner = new OffsetResultIterator(scanner, offset);
        }
        if (limit != null) {
            scanner = new LimitingResultIterator(scanner, limit);
        }
    }
    return scanner;
}
Also used : OffsetResultIterator(org.apache.phoenix.iterate.OffsetResultIterator) UnionResultIterators(org.apache.phoenix.iterate.UnionResultIterators) MergeSortTopNResultIterator(org.apache.phoenix.iterate.MergeSortTopNResultIterator) LimitingResultIterator(org.apache.phoenix.iterate.LimitingResultIterator) OffsetResultIterator(org.apache.phoenix.iterate.OffsetResultIterator) ConcatResultIterator(org.apache.phoenix.iterate.ConcatResultIterator) ResultIterator(org.apache.phoenix.iterate.ResultIterator) MergeSortTopNResultIterator(org.apache.phoenix.iterate.MergeSortTopNResultIterator) LimitingResultIterator(org.apache.phoenix.iterate.LimitingResultIterator) ConcatResultIterator(org.apache.phoenix.iterate.ConcatResultIterator)

Aggregations

ConcatResultIterator (org.apache.phoenix.iterate.ConcatResultIterator)1 LimitingResultIterator (org.apache.phoenix.iterate.LimitingResultIterator)1 MergeSortTopNResultIterator (org.apache.phoenix.iterate.MergeSortTopNResultIterator)1 OffsetResultIterator (org.apache.phoenix.iterate.OffsetResultIterator)1 ResultIterator (org.apache.phoenix.iterate.ResultIterator)1 UnionResultIterators (org.apache.phoenix.iterate.UnionResultIterators)1