Search in sources :

Example 1 with CursorIteratorWrapper

use of org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper 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);
    }
}
Also used : IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IndexRow(org.apache.ignite.internal.cache.query.index.sorted.IndexRow) H2Cursor(org.apache.ignite.internal.processors.query.h2.H2Cursor) CursorIteratorWrapper(org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper) SearchRow(org.h2.result.SearchRow) H2Row(org.apache.ignite.internal.processors.query.h2.opt.H2Row) IndexValueCursor(org.apache.ignite.internal.cache.query.index.sorted.IndexValueCursor)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IndexRow (org.apache.ignite.internal.cache.query.index.sorted.IndexRow)1 IndexValueCursor (org.apache.ignite.internal.cache.query.index.sorted.IndexValueCursor)1 H2Cursor (org.apache.ignite.internal.processors.query.h2.H2Cursor)1 H2Row (org.apache.ignite.internal.processors.query.h2.opt.H2Row)1 CursorIteratorWrapper (org.apache.ignite.internal.processors.query.h2.opt.join.CursorIteratorWrapper)1 SearchRow (org.h2.result.SearchRow)1