Class SortedReducer
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer
-
- org.apache.ignite.internal.processors.query.h2.twostep.SortedReducer
-
- All Implemented Interfaces:
Reducer
public class SortedReducer extends AbstractReducer
Sorted merge index.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.processors.query.h2.twostep.Reducer
Reducer.RowComparator
-
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<org.h2.result.SearchRow>firstRowCmpprotected Comparator<org.h2.result.SearchRow>lastRowCmp-
Fields inherited from class org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer
colCnt, fetched, srcNodes
-
-
Constructor Summary
Constructors Constructor Description SortedReducer(GridKernalContext ctx, Reducer.RowComparator rowComparator)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddPage0(ReduceResultPage page)protected static intbinarySearchRow(List<org.h2.result.Row> rows, org.h2.result.SearchRow searchRow, Comparator<org.h2.result.SearchRow> cmp, boolean checkLast)protected voidcheckBounds(org.h2.result.Row lastEvictedRow, org.h2.result.SearchRow first, org.h2.result.SearchRow last)booleanfetchedAll()Check if all rows has been fetched from all sources.protected org.h2.index.CursorfindAllFetched(List<org.h2.result.Row> fetched, org.h2.result.SearchRow first, org.h2.result.SearchRow last)protected org.h2.index.CursorfindInStream(@Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)voidsetSources(Map<ClusterNode,BitSet> nodesToSegments)Set source nodes.-
Methods inherited from class org.apache.ignite.internal.processors.query.h2.twostep.AbstractReducer
addPage, createDummyLastPage, fail, find, hasSource, onBlockEvict, onFailure, pollNextIterator, setPageSize, sources
-
-
-
-
Field Detail
-
firstRowCmp
protected final Comparator<org.h2.result.SearchRow> firstRowCmp
-
lastRowCmp
protected final Comparator<org.h2.result.SearchRow> lastRowCmp
-
-
Constructor Detail
-
SortedReducer
public SortedReducer(GridKernalContext ctx, Reducer.RowComparator rowComparator)
Constructor.- Parameters:
ctx- Kernal context.rowComparator- Row comparator.
-
-
Method Detail
-
setSources
public void setSources(Map<ClusterNode,BitSet> nodesToSegments)
Set source nodes.- Specified by:
setSourcesin interfaceReducer- Overrides:
setSourcesin classAbstractReducer- Parameters:
nodesToSegments- Mapping of nodes to expected count of segments to scan.
-
fetchedAll
public boolean fetchedAll()
Check if all rows has been fetched from all sources.- Returns:
trueIf all rows has been fetched,falseotherwise.
-
findInStream
protected org.h2.index.Cursor findInStream(@Nullable @Nullable org.h2.result.SearchRow first, @Nullable @Nullable org.h2.result.SearchRow last)- Specified by:
findInStreamin classAbstractReducer- Parameters:
first- Row.last- Row.- Returns:
- Cursor over remote streams.
-
findAllFetched
protected org.h2.index.Cursor findAllFetched(List<org.h2.result.Row> fetched, org.h2.result.SearchRow first, org.h2.result.SearchRow last)
- Specified by:
findAllFetchedin classAbstractReducer- 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)- Overrides:
checkBoundsin classAbstractReducer- Parameters:
lastEvictedRow- Last evicted fetched row.first- Lower bound.last- Upper bound.
-
addPage0
protected void addPage0(ReduceResultPage page)
- Specified by:
addPage0in classAbstractReducer- Parameters:
page- Page.
-
binarySearchRow
protected static int binarySearchRow(List<org.h2.result.Row> rows, org.h2.result.SearchRow searchRow, Comparator<org.h2.result.SearchRow> cmp, boolean checkLast)
- Parameters:
rows- Sorted rows list.searchRow- Search row.cmp- Comparator.checkLast- If we need to optimistically check the last row right away.- Returns:
- Insertion point for the search row.
-
-