use of org.apache.ignite.internal.cache.query.index.SingleCursor in project ignite by apache.
the class InlineIndexImpl method findLast.
/**
* {@inheritDoc}
*/
@Override
public GridCursor<IndexRow> findLast(int segment, IndexQueryContext qryCtx) throws IgniteCheckedException {
InlineTreeFilterClosure closure = filterClosure(qryCtx);
IndexRow found = segments[segment].findLast(closure);
if (found == null || isExpired(found))
return IndexValueCursor.EMPTY;
return new SingleCursor<>(found);
}
use of org.apache.ignite.internal.cache.query.index.SingleCursor in project ignite by apache.
the class InlineIndexImpl method findFirst.
/**
* {@inheritDoc}
*/
@Override
public GridCursor<IndexRow> findFirst(int segment, IndexQueryContext qryCtx) throws IgniteCheckedException {
InlineTreeFilterClosure closure = filterClosure(qryCtx);
IndexRow found = segments[segment].findFirst(closure);
if (found == null || isExpired(found))
return IndexValueCursor.EMPTY;
return new SingleCursor<>(found);
}
use of org.apache.ignite.internal.cache.query.index.SingleCursor in project ignite by apache.
the class GeoSpatialIndexImpl method findFirstOrLast.
/**
* {@inheritDoc}
*/
@Override
public GridCursor<IndexRow> findFirstOrLast(int seg, boolean first) {
Lock l = lock.readLock();
l.lock();
try {
checkClosed();
if (!first)
throw DbException.throwInternalError("Spatial Index can only be fetch by ascending order");
final MVRTreeMap<Long> segment = segments[seg];
GridCursor<IndexRow> iter = rowIterator(segment.keySet().iterator(), null);
return new SingleCursor<>(iter.next() ? iter.get() : null);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
} finally {
l.unlock();
}
}
Aggregations