use of org.apache.ignite.internal.processors.query.h2.H2Cursor in project ignite by apache.
the class GridH2SpatialIndex method find0.
/**
* @param filter Table filter.
* @return Cursor.
*/
private Cursor find0(TableFilter filter) {
Lock l = lock.readLock();
l.lock();
try {
checkClosed();
final int seg = threadLocalSegment();
final MVRTreeMap<Long> segment = segments[seg];
return new H2Cursor(rowIterator(segment.keySet().iterator(), filter));
} finally {
l.unlock();
}
}
use of org.apache.ignite.internal.processors.query.h2.H2Cursor in project ignite by apache.
the class H2TreeIndex method findFirstOrLast.
/**
* {@inheritDoc}
*/
@Override
public Cursor findFirstOrLast(Session ses, boolean b) {
try {
QueryContext qctx = H2Utils.context(ses);
IndexQueryContext qryCtx = idxQryContext(qctx);
GridCursor<IndexRow> cursor = b ? queryIndex.findFirst(segment(qctx), qryCtx) : queryIndex.findLast(segment(qctx), qryCtx);
return new H2Cursor(new IndexValueCursor<>(cursor, this::mapIndexRow));
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
use of org.apache.ignite.internal.processors.query.h2.H2Cursor in project ignite by apache.
the class H2TreeIndex method doFind0.
/**
* {@inheritDoc}
*/
@Override
protected H2Cursor doFind0(IgniteTree t, @Nullable SearchRow first, boolean includeFirst, @Nullable SearchRow last, IndexingQueryFilter filter) {
try {
IndexingQueryCacheFilter pf = partitionFilter(filter);
GridCursor<GridH2Row> range = t.find(first, last, pf);
if (range == null)
range = GridH2IndexBase.EMPTY_CURSOR;
return new H2Cursor(range);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
use of org.apache.ignite.internal.processors.query.h2.H2Cursor in project ignite by apache.
the class GridH2SpatialIndex method findByGeometry.
/**
* {@inheritDoc}
*/
@Override
public Cursor findByGeometry(TableFilter filter, SearchRow first, SearchRow last, SearchRow intersection) {
Value v = intersection.getValue(columnIds[0]);
Geometry g = ((ValueGeometry) v.convertTo(Value.GEOMETRY)).getGeometry();
int seg = segmentsCount() == 1 ? 0 : H2Utils.context(filter.getSession()).segment();
GridCursor<IndexRow> cursor = delegate.findByGeometry(seg, filter, g);
GridCursor<H2Row> h2cursor = new IndexValueCursor<>(cursor, this::mapIndexRow);
return new H2Cursor(h2cursor);
}
use of org.apache.ignite.internal.processors.query.h2.H2Cursor in project ignite by apache.
the class H2TreeIndex method findForSegment.
/**
* Find rows for the segments (distributed joins).
*
* @param bounds Bounds.
* @param segment Segment.
* @param qryCtx Index query context.
* @return Iterator.
*/
public Iterator<H2Row> findForSegment(GridH2RowRangeBounds bounds, int segment, IndexQueryContext qryCtx) {
SearchRow lower = toSearchRow(bounds.first());
SearchRow upper = toSearchRow(bounds.last());
T2<IndexRow, IndexRow> key = prepareIndexKeys(lower, upper);
try {
GridCursor<IndexRow> range = queryIndex.find(key.get1(), key.get2(), true, true, segment, qryCtx);
if (range == null)
range = IndexValueCursor.EMPTY;
GridCursor<H2Row> h2cursor = new IndexValueCursor<>(range, this::mapIndexRow);
H2Cursor cur = new H2Cursor(h2cursor);
return new CursorIteratorWrapper(cur);
} catch (IgniteCheckedException e) {
throw DbException.convert(e);
}
}
Aggregations