Class AbstractReducer
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer
-
- All Implemented Interfaces:
Reducer
- Direct Known Subclasses:
SortedReducer,UnsortedBaseReducer
public abstract class AbstractReducer extends Object implements Reducer
Base class for reducer of remote index lookup results.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.query.h2.twostep.Reducer
Reducer.RowComparator
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPage(ReduceResultPage page)Offer result page for reduce.protected abstract voidaddPage0(ReduceResultPage page)protected voidcheckBounds(org.h2.result.Row lastEvictedRow, org.h2.result.SearchRow first, org.h2.result.SearchRow last)protected ReduceResultPagecreateDummyLastPage(ReduceResultPage lastPage)voidfail(javax.cache.CacheException e)org.h2.index.Cursorfind(@Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)Find a rows and create a cursor to iterate over the result.protected abstract org.h2.index.CursorfindAllFetched(List<org.h2.result.Row> fetched, @Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)protected abstract org.h2.index.CursorfindInStream(@Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)booleanhasSource(UUID nodeId)Check if node with given nodeId is data source node for the index.protected voidonBlockEvict(@NotNull List<org.h2.result.Row> evictedBlock)voidonFailure(UUID nodeId, javax.cache.CacheException e)Fail cursor callback.protected Iterator<org.h2.value.Value[]>pollNextIterator(org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer.Pollable<ReduceResultPage> queue, Iterator<org.h2.value.Value[]> iter)voidsetPageSize(int pageSize)voidsetSources(Map<ClusterNode,BitSet> nodesToSegmentsCnt)Set source nodes.Set<UUID>sources()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.processors.query.h2.twostep.Reducer
fetchedAll
-
-
-
-
Field Detail
-
colCnt
protected int colCnt
-
fetched
protected final ReduceBlockList<org.h2.result.Row> fetched
Will be r/w from query execution thread only, does not need to be threadsafe.
-
-
Method Detail
-
setSources
public void setSources(Map<ClusterNode,BitSet> nodesToSegmentsCnt)
Set source nodes.- Specified by:
setSourcesin interfaceReducer- Parameters:
nodesToSegmentsCnt- Mapping of nodes to expected count of segments to scan.
-
hasSource
public boolean hasSource(UUID nodeId)
Check if node with given nodeId is data source node for the index.
-
setPageSize
public void setPageSize(int pageSize)
- Specified by:
setPageSizein interfaceReducer- Parameters:
pageSize- Page size.
-
onFailure
public void onFailure(UUID nodeId, javax.cache.CacheException e)
Fail cursor callback.
-
find
public final org.h2.index.Cursor find(@Nullable @Nullable org.h2.result.SearchRow first, @Nullable @Nullable org.h2.result.SearchRow last)Find a rows and create a cursor to iterate over the result.
-
findInStream
protected abstract org.h2.index.Cursor findInStream(@Nullable @Nullable org.h2.result.SearchRow first, @Nullable @Nullable org.h2.result.SearchRow last)- Parameters:
first- Row.last- Row.- Returns:
- Cursor over remote streams.
-
findAllFetched
protected abstract org.h2.index.Cursor findAllFetched(List<org.h2.result.Row> fetched, @Nullable @Nullable org.h2.result.SearchRow first, @Nullable @Nullable org.h2.result.SearchRow last)
- Parameters:
fetched- Fetched data.first- Row.last- Row.- Returns:
- Cursor over fetched data.
-
checkBounds
protected void checkBounds(org.h2.result.Row lastEvictedRow, org.h2.result.SearchRow first, org.h2.result.SearchRow last)- Parameters:
lastEvictedRow- Last evicted fetched row.first- Lower bound.last- Upper bound.
-
onBlockEvict
protected void onBlockEvict(@NotNull @NotNull List<org.h2.result.Row> evictedBlock)- Parameters:
evictedBlock- Evicted block.
-
addPage
public void addPage(ReduceResultPage page)
Offer result page for reduce.
-
addPage0
protected abstract void addPage0(ReduceResultPage page)
- Parameters:
page- Page.
-
fail
public void fail(javax.cache.CacheException e)
- Parameters:
e- Error.
-
createDummyLastPage
protected final ReduceResultPage createDummyLastPage(ReduceResultPage lastPage)
- Parameters:
lastPage- Real last page.- Returns:
- Created dummy page.
-
pollNextIterator
protected final Iterator<org.h2.value.Value[]> pollNextIterator(org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer.Pollable<ReduceResultPage> queue, Iterator<org.h2.value.Value[]> iter)
- Parameters:
queue- Queue to poll.iter- Current iterator.- Returns:
- The same or new iterator.
-
-