Search in sources :

Example 1 with GridCursorIteratorWrapper

use of org.apache.ignite.internal.util.GridCursorIteratorWrapper in project ignite by apache.

the class GridH2SpatialIndex method rowIterator.

/**
 * @param i Spatial key iterator.
 * @param filter Table filter.
 * @return Iterator over rows.
 */
@SuppressWarnings("unchecked")
private GridCursor<GridH2Row> rowIterator(Iterator<SpatialKey> i, TableFilter filter) {
    if (!i.hasNext())
        return EMPTY_CURSOR;
    long time = System.currentTimeMillis();
    IndexingQueryFilter qryFilter = threadLocalFilter();
    IndexingQueryCacheFilter qryCacheFilter = qryFilter != null ? qryFilter.forCache(getTable().cacheName()) : null;
    List<GridH2Row> rows = new ArrayList<>();
    do {
        GridH2Row row = idToRow.get(i.next().getId());
        assert row != null;
        if (row.expireTime() != 0 && row.expireTime() <= time)
            continue;
        if (qryCacheFilter == null || qryCacheFilter.applyPartition(row.partition()))
            rows.add(row);
    } while (i.hasNext());
    return new GridCursorIteratorWrapper(rows.iterator());
}
Also used : IndexingQueryFilter(org.apache.ignite.spi.indexing.IndexingQueryFilter) ArrayList(java.util.ArrayList) GridCursorIteratorWrapper(org.apache.ignite.internal.util.GridCursorIteratorWrapper) IndexingQueryCacheFilter(org.apache.ignite.spi.indexing.IndexingQueryCacheFilter)

Aggregations

ArrayList (java.util.ArrayList)1 GridCursorIteratorWrapper (org.apache.ignite.internal.util.GridCursorIteratorWrapper)1 IndexingQueryCacheFilter (org.apache.ignite.spi.indexing.IndexingQueryCacheFilter)1 IndexingQueryFilter (org.apache.ignite.spi.indexing.IndexingQueryFilter)1