Search in sources :

Example 46 with Tuple

use of org.apache.phoenix.schema.tuple.Tuple in project phoenix by apache.

the class ConcatResultIterator method currentIterator.

private PeekingResultIterator currentIterator() throws SQLException {
    List<PeekingResultIterator> iterators = getIterators();
    while (index < iterators.size()) {
        PeekingResultIterator iterator = iterators.get(index);
        Tuple r = iterator.peek();
        if (r != null) {
            return iterator;
        }
        iterator.close();
        index++;
    }
    return EMPTY_ITERATOR;
}
Also used : Tuple(org.apache.phoenix.schema.tuple.Tuple)

Example 47 with Tuple

use of org.apache.phoenix.schema.tuple.Tuple in project phoenix by apache.

the class DistinctAggregatingResultIterator method getResultIterator.

private Iterator<ResultEntry> getResultIterator() throws SQLException {
    if (resultIterator != null) {
        return resultIterator;
    }
    // TODO: size?
    Set<ResultEntry> entries = Sets.<ResultEntry>newHashSet();
    try {
        for (Tuple result = delegate.next(); result != null; result = delegate.next()) {
            ResultEntry entry = new ResultEntry(result);
            entries.add(entry);
        }
    } finally {
        delegate.close();
    }
    resultIterator = entries.iterator();
    return resultIterator;
}
Also used : Tuple(org.apache.phoenix.schema.tuple.Tuple)

Example 48 with Tuple

use of org.apache.phoenix.schema.tuple.Tuple in project phoenix by apache.

the class LookAheadResultIterator method next.

@Override
public Tuple next() throws SQLException {
    init();
    Tuple next = this.next;
    this.next = advance();
    return next;
}
Also used : Tuple(org.apache.phoenix.schema.tuple.Tuple) ResultTuple(org.apache.phoenix.schema.tuple.ResultTuple)

Example 49 with Tuple

use of org.apache.phoenix.schema.tuple.Tuple in project phoenix by apache.

the class MaterializedComparableResultIterator method next.

@Override
public Tuple next() throws SQLException {
    Tuple next = delegate.next();
    this.current = delegate.peek();
    return next;
}
Also used : Tuple(org.apache.phoenix.schema.tuple.Tuple)

Example 50 with Tuple

use of org.apache.phoenix.schema.tuple.Tuple in project phoenix by apache.

the class MergeSortResultIterator method next.

@Override
public Tuple next() throws SQLException {
    MaterializedComparableResultIterator iterator = minIterator();
    if (iterator == null) {
        return null;
    }
    Tuple next = iterator.next();
    minHeap.poll();
    if (iterator.peek() != null) {
        minHeap.add(iterator);
    } else {
        iterator.close();
    }
    return next;
}
Also used : Tuple(org.apache.phoenix.schema.tuple.Tuple)

Aggregations

Tuple (org.apache.phoenix.schema.tuple.Tuple)50 SingleKeyValueTuple (org.apache.phoenix.schema.tuple.SingleKeyValueTuple)22 KeyValue (org.apache.hadoop.hbase.KeyValue)16 ImmutableBytesWritable (org.apache.hadoop.hbase.io.ImmutableBytesWritable)12 List (java.util.List)11 ArrayList (java.util.ArrayList)10 Expression (org.apache.phoenix.expression.Expression)9 Test (org.junit.Test)9 SQLException (java.sql.SQLException)8 Cell (org.apache.hadoop.hbase.Cell)8 LiteralExpression (org.apache.phoenix.expression.LiteralExpression)7 ResultIterator (org.apache.phoenix.iterate.ResultIterator)7 PColumn (org.apache.phoenix.schema.PColumn)7 ImmutableBytesPtr (org.apache.phoenix.hbase.index.util.ImmutableBytesPtr)6 TableRef (org.apache.phoenix.schema.TableRef)6 Region (org.apache.hadoop.hbase.regionserver.Region)5 MutationState (org.apache.phoenix.execute.MutationState)5 ProjectedColumnExpression (org.apache.phoenix.expression.ProjectedColumnExpression)5 Aggregator (org.apache.phoenix.expression.aggregator.Aggregator)5 PTable (org.apache.phoenix.schema.PTable)5