public class GridH2Table
extends org.gridgain.internal.h2.table.TableBase
| Constructor and Description |
|---|
GridH2Table(org.gridgain.internal.h2.command.ddl.CreateTableData createTblData,
GridH2RowDescriptor desc,
H2TableDescriptor tblDesc,
GridCacheContextInfo cacheInfo)
Creates table.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addColumns(List<QueryField> cols,
boolean ifNotExists)
Add new columns to this table.
|
org.gridgain.internal.h2.index.Index |
addIndex(org.gridgain.internal.h2.engine.Session ses,
String idxName,
int idxId,
org.gridgain.internal.h2.table.IndexColumn[] cols,
org.gridgain.internal.h2.index.IndexType idxType,
boolean create,
String idxComment) |
void |
addRow(org.gridgain.internal.h2.engine.Session ses,
org.gridgain.internal.h2.result.Row row) |
@Nullable GridCacheContext |
cacheContext() |
int |
cacheId() |
GridCacheContextInfo |
cacheInfo() |
String |
cacheName() |
boolean |
canDrop() |
boolean |
canGetRowCount() |
boolean |
checkIfIndexesRebuildRequired() |
void |
checkRename() |
void |
checkSupportAlter() |
static void |
checkTablesVersions(org.gridgain.internal.h2.engine.Session s) |
void |
close(org.gridgain.internal.h2.engine.Session ses) |
void |
collectIndexesForPartialRebuild(IndexRebuildPartialClosure clo,
boolean force)
Collect indexes for rebuild.
|
void |
destroy()
Destroy the table.
|
void |
dropColumns(List<String> cols,
boolean ifExists)
Drop columns.
|
@Nullable org.gridgain.internal.h2.table.IndexColumn |
getAffinityKeyColumn() |
org.gridgain.internal.h2.table.Column[] |
getColumns() |
long |
getDiskSpaceUsed() |
@Nullable org.gridgain.internal.h2.table.IndexColumn |
getExplicitAffinityKeyColumn() |
ArrayList<org.gridgain.internal.h2.index.Index> |
getIndexes() |
@Nullable org.gridgain.internal.h2.index.Index |
getIndexSafe(String indexName)
Get an index by name.
|
long |
getMaxDataModificationId() |
long |
getRowCount(@Nullable org.gridgain.internal.h2.engine.Session ses) |
long |
getRowCountApproximation(org.gridgain.internal.h2.engine.Session ses) |
org.gridgain.internal.h2.index.Index |
getScanIndex(org.gridgain.internal.h2.engine.Session ses) |
org.gridgain.internal.h2.table.TableType |
getTableType() |
org.gridgain.internal.h2.index.Index |
getUniqueIndex() |
QueryTable |
identifier() |
String |
identifierString() |
org.gridgain.internal.h2.table.IndexColumn |
indexColumn(int col,
int sorting)
Creates index column for table.
|
List<IndexInformation> |
indexesInformation() |
boolean |
isCacheLazy() |
boolean |
isColumnForPartitionPruning(org.gridgain.internal.h2.table.Column col)
Check whether passed column can be used for partition pruning.
|
boolean |
isColumnForPartitionPruningStrict(org.gridgain.internal.h2.table.Column col)
Check whether passed column could be used for partition transfer during partition pruning on joined tables and
for external affinity calculation (e.g. on thin clients).
|
boolean |
isCustomAffinityMapper() |
boolean |
isDeterministic() |
boolean |
isLockedExclusively() |
boolean |
isLockedExclusivelyBy(org.gridgain.internal.h2.engine.Session ses) |
boolean |
isPartitioned() |
boolean |
lock(org.gridgain.internal.h2.engine.Session ses,
boolean exclusive,
boolean force) |
void |
markRebuildFromHashInProgress(boolean value)
Mark or unmark index rebuild state.
|
void |
prepareIndexesForRebuild(org.gridgain.internal.h2.engine.Session session)
Destroys the old data and recreate the index.
|
void |
proposeUserIndex(org.gridgain.internal.h2.index.Index idx)
Add index that is in an intermediate state and is still being built, thus is not used in queries until it is
promoted.
|
static void |
readLockTables(org.gridgain.internal.h2.engine.Session s) |
boolean |
rebuildFromHashInProgress() |
boolean |
remove(CacheDataRow row)
Remove row.
|
void |
removeChildrenAndResources(org.gridgain.internal.h2.engine.Session ses) |
void |
removeIndex(org.gridgain.internal.h2.index.Index h2Idx) |
void |
removeIndex(org.gridgain.internal.h2.engine.Session session,
org.gridgain.internal.h2.index.Index h2Idx)
Remove the given index from the list.
|
void |
removeRow(org.gridgain.internal.h2.engine.Session ses,
org.gridgain.internal.h2.result.Row row) |
void |
rollbackUserIndex(String idxName)
Remove user index without promoting it.
|
GridH2RowDescriptor |
rowDescriptor() |
byte[] |
rowKeyBytes(Object row) |
byte[] |
rowValueBytes(Object row) |
protected void |
setColumns(org.gridgain.internal.h2.table.Column[] columns) |
void |
setRemoveIndexOnDestroy(boolean rmIndex)
If flag
True, index will be destroyed when table destroy(). |
ObjectStatistics |
tableStatistics()
Get actual table statistics if exists.
|
void |
truncate(org.gridgain.internal.h2.engine.Session ses) |
void |
unlock(org.gridgain.internal.h2.engine.Session ses) |
static void |
unlockTables(org.gridgain.internal.h2.engine.Session s) |
void |
update(CacheDataRow row,
@Nullable CacheDataRow prevRow,
boolean prevRowAvailable)
Updates table for given key.
|
@Nullable org.gridgain.internal.h2.index.Index |
userIndex(String idxName)
Get user index with provided name.
|
getCreateSQL, getDropSQL, getMainIndexColumn, isGlobalTemporaryaddConstraint, addDependencies, addDependentView, addSequence, addSynonym, addTrigger, canReference, canTruncate, checkDeadlock, checkWritingAllowed, compareValues, createRow, doesColumnExist, dropMultipleColumnsConstraintsAndIndexes, findPrimaryKey, fire, fireAfterRow, fireBeforeRow, fireRow, getBestPlanItem, getCheckForeignKeyConstraints, getChildren, getColumn, getColumn, getCompareMode, getConstraints, getCreateSQLForCopy, getDefaultValue, getDependentViews, getIndex, getIndexForColumn, getOnCommitDrop, getOnCommitTruncate, getOnUpdateValue, getPrimaryKey, getRow, getRowIdColumn, getScanIndex, getSearchRow, getTemplateRow, getTemplateSimpleRow, getType, getVisibleColums, hasSelectTrigger, isHidden, isMVStore, isPersistData, isPersistIndexes, isQueryComparable, isTableExpression, isView, lockRow, removeConstraint, removeDependentView, removeIndexOrTransferOwnership, removeSequence, removeSynonym, removeTrigger, rename, renameColumn, setCheckForeignKeyConstraints, setHidden, setOnCommitDrop, setOnCommitTruncate, setTableExpression, updateRow, updateRows, validateConvertUpdateSequencegetSchema, getSQL, getSQLgetComment, getDatabase, getId, getModificationId, getName, invalidate, isTemporary, isValid, setComment, setModified, setObjectName, setTemporary, toStringpublic GridH2Table(org.gridgain.internal.h2.command.ddl.CreateTableData createTblData,
GridH2RowDescriptor desc,
H2TableDescriptor tblDesc,
GridCacheContextInfo cacheInfo)
createTblData - Table description.desc - Row descriptor.tblDesc - Indexes factory.cacheInfo - Cache context info.public List<IndexInformation> indexesInformation()
public boolean isPartitioned()
true If this is a partitioned table.@Nullable public @Nullable org.gridgain.internal.h2.table.IndexColumn getAffinityKeyColumn()
null if not available.@Nullable public @Nullable org.gridgain.internal.h2.table.IndexColumn getExplicitAffinityKeyColumn()
null if not available (skip _KEY column or it's alias).public boolean isColumnForPartitionPruning(org.gridgain.internal.h2.table.Column col)
col - Column.True if affinity key column.public boolean isColumnForPartitionPruningStrict(org.gridgain.internal.h2.table.Column col)
Note that it is different from isColumnForPartitionPruning(Column) method in that not every column
which qualifies for partition pruning can be used by thin clients or join partition pruning logic.
Consider the following schema:
CREATE TABLE dept (id PRIMARY KEY); CREATE TABLE emp (id, dept_id AFFINITY KEY, PRIMARY KEY(id, dept_id));For expression-based partition pruning on "emp" table on the server side we may use both "_KEY" and "dept_id" columns, as passing them through standard affinity workflow will yield the same result: dept_id -> part _KEY -> dept_id -> part
But we cannot use "_KEY" on thin client side, as it doesn't know how to extract affinity key field properly. Neither we can perform partition transfer in JOINs when "_KEY" is used.
This is OK as data is collocated, so we can merge partitions extracted from both tables:
SELECT * FROM dept d INNER JOIN emp e ON d.id = e.dept_id WHERE e.dept_id=? AND d.id=?But this is not OK as joined data is not collocated, and tables form distinct collocation groups:
SELECT * FROM dept d INNER JOIN emp e ON d.id = e._KEY WHERE e.dept_id=? AND d.id=?NB: The last query is not logically correct and will produce empty result. However, it is correct from SQL perspective, so we should make incorrect assumptions about partitions as it may make situation even worse.
col - Column.True if column could be used for partition extraction on both server and client sides and for
partition transfer in joins.public boolean isCustomAffinityMapper()
public long getDiskSpaceUsed()
getDiskSpaceUsed in class org.gridgain.internal.h2.table.Tablepublic GridH2RowDescriptor rowDescriptor()
public String cacheName()
public int cacheId()
public GridCacheContextInfo cacheInfo()
public boolean isCacheLazy()
true If Cache is lazy (not full inited).public ObjectStatistics tableStatistics()
null if there is no statistics available.@Nullable public @Nullable GridCacheContext cacheContext()
public boolean lock(org.gridgain.internal.h2.engine.Session ses,
boolean exclusive,
boolean force)
lock in class org.gridgain.internal.h2.table.Tablepublic void unlock(org.gridgain.internal.h2.engine.Session ses)
unlock in class org.gridgain.internal.h2.table.Tablepublic QueryTable identifier()
public String identifierString()
public void close(org.gridgain.internal.h2.engine.Session ses)
close in class org.gridgain.internal.h2.table.Tablepublic void removeChildrenAndResources(org.gridgain.internal.h2.engine.Session ses)
removeChildrenAndResources in interface org.gridgain.internal.h2.engine.DbObjectremoveChildrenAndResources in class org.gridgain.internal.h2.table.Tablepublic void destroy()
public void setRemoveIndexOnDestroy(boolean rmIndex)
True, index will be destroyed when table destroy().rmIndex - Flag indicate remove index on destroy or not.public void update(CacheDataRow row, @Nullable @Nullable CacheDataRow prevRow, boolean prevRowAvailable) throws IgniteCheckedException
row - Row to be updated.prevRow - Previous row.prevRowAvailable - Whether previous row is available.IgniteCheckedException - If failed.public boolean remove(CacheDataRow row) throws IgniteCheckedException
row - Row.True if was removed.IgniteCheckedException - If failed.public void collectIndexesForPartialRebuild(IndexRebuildPartialClosure clo, boolean force)
clo - Closure.force - Force rebuild indexes.public boolean checkIfIndexesRebuildRequired()
public void markRebuildFromHashInProgress(boolean value)
public boolean rebuildFromHashInProgress()
public org.gridgain.internal.h2.index.Index addIndex(org.gridgain.internal.h2.engine.Session ses,
String idxName,
int idxId,
org.gridgain.internal.h2.table.IndexColumn[] cols,
org.gridgain.internal.h2.index.IndexType idxType,
boolean create,
String idxComment)
addIndex in class org.gridgain.internal.h2.table.Tablepublic void proposeUserIndex(org.gridgain.internal.h2.index.Index idx)
throws IgniteCheckedException
idx - Index to add.IgniteCheckedException - If failed.public void rollbackUserIndex(String idxName)
idxName - Index name.@Nullable public @Nullable org.gridgain.internal.h2.index.Index userIndex(String idxName)
idxName - Index name.null othwerwise.public void removeIndex(org.gridgain.internal.h2.index.Index h2Idx)
removeIndex in class org.gridgain.internal.h2.table.Tablepublic void removeIndex(org.gridgain.internal.h2.engine.Session session,
org.gridgain.internal.h2.index.Index h2Idx)
h2Idx - the index to removepublic void removeRow(org.gridgain.internal.h2.engine.Session ses,
org.gridgain.internal.h2.result.Row row)
removeRow in class org.gridgain.internal.h2.table.Tablepublic void truncate(org.gridgain.internal.h2.engine.Session ses)
truncate in class org.gridgain.internal.h2.table.Tablepublic void addRow(org.gridgain.internal.h2.engine.Session ses,
org.gridgain.internal.h2.result.Row row)
addRow in class org.gridgain.internal.h2.table.Tablepublic void checkSupportAlter()
checkSupportAlter in class org.gridgain.internal.h2.table.Tablepublic org.gridgain.internal.h2.table.TableType getTableType()
getTableType in class org.gridgain.internal.h2.table.Tablepublic org.gridgain.internal.h2.index.Index getScanIndex(org.gridgain.internal.h2.engine.Session ses)
getScanIndex in class org.gridgain.internal.h2.table.Tablepublic org.gridgain.internal.h2.index.Index getUniqueIndex()
getUniqueIndex in class org.gridgain.internal.h2.table.Tablepublic ArrayList<org.gridgain.internal.h2.index.Index> getIndexes()
getIndexes in class org.gridgain.internal.h2.table.Tablepublic boolean isLockedExclusively()
isLockedExclusively in class org.gridgain.internal.h2.table.Tablepublic boolean isLockedExclusivelyBy(org.gridgain.internal.h2.engine.Session ses)
isLockedExclusivelyBy in class org.gridgain.internal.h2.table.Tablepublic long getMaxDataModificationId()
getMaxDataModificationId in class org.gridgain.internal.h2.table.Tablepublic boolean isDeterministic()
isDeterministic in class org.gridgain.internal.h2.table.Tablepublic boolean canGetRowCount()
canGetRowCount in class org.gridgain.internal.h2.table.Tablepublic boolean canDrop()
canDrop in class org.gridgain.internal.h2.table.Tablepublic long getRowCount(@Nullable
@Nullable org.gridgain.internal.h2.engine.Session ses)
getRowCount in class org.gridgain.internal.h2.table.Tablepublic long getRowCountApproximation(org.gridgain.internal.h2.engine.Session ses)
getRowCountApproximation in class org.gridgain.internal.h2.table.Tablepublic void prepareIndexesForRebuild(org.gridgain.internal.h2.engine.Session session)
throws IgniteCheckedException
session - Session.IgniteCheckedException - In case we were unable to destroy the data.public void checkRename()
checkRename in interface org.gridgain.internal.h2.engine.DbObjectcheckRename in class org.gridgain.internal.h2.engine.DbObjectBasepublic org.gridgain.internal.h2.table.IndexColumn indexColumn(int col,
int sorting)
col - Column index.sorting - Sorting order SortOrderpublic void addColumns(List<QueryField> cols, boolean ifNotExists)
cols - Columns to add.ifNotExists - Ignore this command if cols has size of 1 and column with given name already exists.public void dropColumns(List<String> cols, boolean ifExists)
cols - Columns.ifExists - If EXISTS flag.protected void setColumns(org.gridgain.internal.h2.table.Column[] columns)
setColumns in class org.gridgain.internal.h2.table.Tablepublic org.gridgain.internal.h2.table.Column[] getColumns()
getColumns in class org.gridgain.internal.h2.table.Tablepublic static void unlockTables(org.gridgain.internal.h2.engine.Session s)
s - H2 session.public static void readLockTables(org.gridgain.internal.h2.engine.Session s)
s - H2 session.public static void checkTablesVersions(org.gridgain.internal.h2.engine.Session s)
s - H2 session.public byte[] rowValueBytes(Object row)
public byte[] rowKeyBytes(Object row)
@Nullable public @Nullable org.gridgain.internal.h2.index.Index getIndexSafe(String indexName)
indexName - Index name to search for.null if not found.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 8.9.17-p1 Release Date : November 27 2025