Class ReduceIndex
- java.lang.Object
-
- org.h2.engine.DbObjectBase
-
- org.h2.schema.SchemaObjectBase
-
- org.h2.index.BaseIndex
-
- org.apache.ignite.internal.processors.query.h2.twostep.ReduceIndex
-
- All Implemented Interfaces:
org.h2.engine.DbObject,org.h2.index.Index,org.h2.schema.SchemaObject
public abstract class ReduceIndex extends org.h2.index.BaseIndexMerge index.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classReduceIndex.FetchingCursorFetching cursor.protected static interfaceReduceIndex.Pollable<E>Pollable.
-
Field Summary
Fields Modifier and Type Field Description protected Comparator<org.h2.result.SearchRow>firstRowCmpprotected Comparator<org.h2.result.SearchRow>lastRowCmp
-
Constructor Summary
Constructors Modifier Constructor Description protectedReduceIndex(GridKernalContext ctx)protectedReduceIndex(GridKernalContext ctx, ReduceTable tbl, String name, org.h2.index.IndexType type, org.h2.table.IndexColumn[] cols)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(org.h2.engine.Session ses, org.h2.result.Row row)voidaddPage(ReduceResultPage page)protected abstract 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)booleancanGetFirstOrLast()protected voidcheckBounds(org.h2.result.Row lastEvictedRow, org.h2.result.SearchRow first, org.h2.result.SearchRow last)voidcheckRename()voidclose(org.h2.engine.Session ses)protected ReduceResultPagecreateDummyLastPage(ReduceResultPage lastPage)voidfail(UUID nodeId, javax.cache.CacheException e)voidfail(javax.cache.CacheException e)abstract booleanfetchedAll()org.h2.index.Cursorfind(org.h2.engine.Session ses, org.h2.result.SearchRow first, org.h2.result.SearchRow last)protected abstract org.h2.index.CursorfindAllFetched(List<org.h2.result.Row> fetched, @Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)org.h2.index.CursorfindFirstOrLast(org.h2.engine.Session ses, boolean first)protected abstract org.h2.index.CursorfindInStream(@Nullable org.h2.result.SearchRow first, @Nullable org.h2.result.SearchRow last)longgetDiskSpaceUsed()longgetRowCount(org.h2.engine.Session ses)longgetRowCountApproximation()booleanhasSource(UUID nodeId)static <Z> Zlast(List<Z> l)booleanneedRebuild()protected Iterator<org.h2.value.Value[]>pollNextIterator(ReduceIndex.Pollable<ReduceResultPage> queue, Iterator<org.h2.value.Value[]> iter)voidremove(org.h2.engine.Session ses)voidremove(org.h2.engine.Session ses, org.h2.result.Row row)voidsetPageSize(int pageSize)voidsetSources(Collection<ClusterNode> nodes, int segmentsCnt)Set source nodes.Set<UUID>sources()voidtruncate(org.h2.engine.Session ses)-
Methods inherited from class org.h2.index.BaseIndex
canFindNext, canScan, checkIndexColumnTypes, commit, compareRows, createLookupBatch, find, findNext, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQL, getCreateSQLForCopy, getDropSQL, getDuplicateKeyException, getIndexColumns, getIndexType, getPlanSQL, getRow, getTable, getType, initBaseIndex, isFindUsingFullTableScan, isFirstColumn, isHidden, isRowIdIndex, mayHaveNullDuplicates, removeChildrenAndResources, setSortedInsertMode
-
Methods inherited from class org.h2.engine.DbObjectBase
getChildren, getComment, getDatabase, getId, getModificationId, getName, initDbObjectBase, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
firstRowCmp
protected final Comparator<org.h2.result.SearchRow> firstRowCmp
-
lastRowCmp
protected final Comparator<org.h2.result.SearchRow> lastRowCmp
-
-
Constructor Detail
-
ReduceIndex
protected ReduceIndex(GridKernalContext ctx, ReduceTable tbl, String name, org.h2.index.IndexType type, org.h2.table.IndexColumn[] cols)
- Parameters:
ctx- Context.tbl- Table.name- Index name.type- Type.cols- Columns.
-
ReduceIndex
protected ReduceIndex(GridKernalContext ctx)
- Parameters:
ctx- Context.
-
-
Method Detail
-
hasSource
public boolean hasSource(UUID nodeId)
- Parameters:
nodeId- Node ID.- Returns:
trueIf this index needs data from the given source node.
-
getRowCount
public long getRowCount(org.h2.engine.Session ses)
-
getRowCountApproximation
public long getRowCountApproximation()
-
setSources
public void setSources(Collection<ClusterNode> nodes, int segmentsCnt)
Set source nodes.- Parameters:
nodes- Nodes.segmentsCnt- Index segments per table.
-
setPageSize
public void setPageSize(int pageSize)
- Parameters:
pageSize- Page size.
-
pollNextIterator
protected final Iterator<org.h2.value.Value[]> pollNextIterator(ReduceIndex.Pollable<ReduceResultPage> queue, Iterator<org.h2.value.Value[]> iter)
- Parameters:
queue- Queue to poll.iter- Current iterator.- Returns:
- The same or new iterator.
-
fail
public void fail(javax.cache.CacheException e)
- Parameters:
e- Error.
-
fail
public void fail(UUID nodeId, javax.cache.CacheException e)
- Parameters:
nodeId- Node ID.e- Exception.
-
addPage
public final void addPage(ReduceResultPage page)
- Parameters:
page- Page.
-
createDummyLastPage
protected final ReduceResultPage createDummyLastPage(ReduceResultPage lastPage)
- Parameters:
lastPage- Real last page.- Returns:
- Created dummy page.
-
addPage0
protected abstract void addPage0(ReduceResultPage page)
- Parameters:
page- Page.
-
find
public final org.h2.index.Cursor find(org.h2.engine.Session ses, org.h2.result.SearchRow first, org.h2.result.SearchRow last)
-
fetchedAll
public abstract boolean fetchedAll()
- Returns:
trueIf we have fetched all the remote rows into a fetched list.
-
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.
-
findInStream
protected abstract org.h2.index.Cursor findInStream(@Nullable @Nullable org.h2.result.SearchRow first, @Nullable @Nullable org.h2.result.SearchRow last)- Parameters:
first- Lower bound.last- Upper bound.- Returns:
- Cursor. Usually it must be
ReduceIndex.FetchingCursorinstance.
-
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 rows.first- Lower bound.last- Upper bound.- Returns:
- Cursor.
-
checkRename
public void checkRename()
- Specified by:
checkRenamein interfaceorg.h2.engine.DbObject- Specified by:
checkRenamein classorg.h2.engine.DbObjectBase
-
close
public void close(org.h2.engine.Session ses)
-
add
public void add(org.h2.engine.Session ses, org.h2.result.Row row)
-
remove
public void remove(org.h2.engine.Session ses, org.h2.result.Row row)
-
remove
public void remove(org.h2.engine.Session ses)
-
truncate
public void truncate(org.h2.engine.Session ses)
-
canGetFirstOrLast
public boolean canGetFirstOrLast()
-
findFirstOrLast
public org.h2.index.Cursor findFirstOrLast(org.h2.engine.Session ses, boolean first)
-
needRebuild
public boolean needRebuild()
-
getDiskSpaceUsed
public long getDiskSpaceUsed()
-
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.
-
last
public static <Z> Z last(List<Z> l)
- Parameters:
l- List.- Returns:
- Last element.
-
-