use of org.h2.index.Cursor in project ignite by apache.
the class GridH2SpatialIndex method findFirstOrLast.
/**
* {@inheritDoc}
*/
@Override
public Cursor findFirstOrLast(Session ses, 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 int seg = threadLocalSegment();
final MVRTreeMap<Long> segment = segments[seg];
GridCursor<GridH2Row> iter = rowIterator(segment.keySet().iterator(), null);
return new SingleRowCursor(iter.next() ? iter.get() : null);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
} finally {
l.unlock();
}
}
use of org.h2.index.Cursor in project ignite by apache.
the class H2PkHashIndex method getRowCount.
/**
* {@inheritDoc}
*/
@Override
public long getRowCount(Session ses) {
Cursor cursor = find(ses, null, null);
long res = 0;
while (cursor.next()) res++;
return res;
}
Aggregations