Class GridH2IndexBase

  • All Implemented Interfaces:
    org.h2.engine.DbObject, org.h2.index.Index, org.h2.schema.SchemaObject
    Direct Known Subclasses:
    H2PkHashIndex, H2TreeIndexBase

    public abstract class GridH2IndexBase
    extends H2IndexCostedBase
    Index base.
    • Field Summary

      • Fields inherited from class org.h2.index.BaseIndex

        columnIds, columns, indexColumns, indexType, isMultiVersion, table
      • Fields inherited from class org.h2.engine.DbObjectBase

        comment, database, trace
      • Fields inherited from interface org.h2.engine.DbObject

        AGGREGATE, COMMENT, CONSTANT, CONSTRAINT, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, TRIGGER, USER, USER_DATATYPE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected GridH2IndexBase​(GridH2Table tbl, String name, org.h2.table.IndexColumn[] cols, org.h2.index.IndexType type)
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(org.h2.engine.Session ses, org.h2.result.Row row)
      void checkRename()
      void close​(org.h2.engine.Session ses)
      static @NotNull org.h2.table.IndexColumn[] columnsArray​(GridH2Table tbl, List<org.h2.table.IndexColumn> colsList)  
      void destroy()
      Attempts to destroys index and release all the resources.
      long getDiskSpaceUsed()
      int getDistributedMultiplier​(org.h2.engine.Session ses, org.h2.table.TableFilter[] filters, int filter)  
      long getRowCountApproximation()
      GridH2Table getTable()
      boolean needRebuild()
      abstract H2CacheRow put​(H2CacheRow row)
      Puts row.
      abstract boolean putx​(H2CacheRow row)
      Puts row.
      protected QueryContextRegistry queryContextRegistry()  
      void refreshColumnIds()
      Re-assign column ids after removal of column(s).
      void remove​(org.h2.engine.Session ses)
      void remove​(org.h2.engine.Session ses, org.h2.result.Row row)
      abstract boolean removex​(org.h2.result.SearchRow row)
      Removes row from index.
      protected GridH2RowDescriptor rowDescriptor()  
      protected int segment​(QueryContext qctx)  
      int segmentForPartition​(int partition)  
      protected int segmentForRow​(GridCacheContext ctx, org.h2.result.SearchRow row)  
      abstract int segmentsCount()  
      abstract long totalRowCount​(IndexingQueryCacheFilter partsFilter)  
      void truncate​(org.h2.engine.Session ses)
      <T extends Index>
      T
      unwrap​(Class<T> clazz)
      Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.
      • 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, getType, initBaseIndex, isFindUsingFullTableScan, isFirstColumn, isHidden, isRowIdIndex, mayHaveNullDuplicates, removeChildrenAndResources, setSortedInsertMode
      • Methods inherited from class org.h2.schema.SchemaObjectBase

        getSchema, getSQL, initSchemaObjectBase
      • 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 interface org.h2.engine.DbObject

        getChildren, getComment, getDatabase, getId, getName, getSQL, isTemporary, rename, setComment, setTemporary
      • Methods inherited from interface org.h2.index.Index

        canGetFirstOrLast, find, findFirstOrLast, getCost, getRowCount
      • Methods inherited from interface org.h2.schema.SchemaObject

        getSchema
    • Constructor Detail

      • GridH2IndexBase

        protected GridH2IndexBase​(GridH2Table tbl,
                                  String name,
                                  org.h2.table.IndexColumn[] cols,
                                  org.h2.index.IndexType type)
        Constructor.
        Parameters:
        tbl - Table.
        name - Index name.
        cols - Indexed columns.
        type - Index type.
    • Method Detail

      • close

        public final void close​(org.h2.engine.Session ses)
      • destroy

        public void destroy()
        Attempts to destroys index and release all the resources. We use this method instead of close(Session) because that method is used by H2 internally.
      • segment

        protected int segment​(QueryContext qctx)
        Parameters:
        qctx - Query context.
        Returns:
        Index segment ID for current query context.
      • put

        public abstract H2CacheRow put​(H2CacheRow row)
        Puts row.
        Parameters:
        row - Row.
        Returns:
        Existing row or null.
      • putx

        public abstract boolean putx​(H2CacheRow row)
        Puts row.
        Parameters:
        row - Row.
        Returns:
        True if existing row row has been replaced.
      • removex

        public abstract boolean removex​(org.h2.result.SearchRow row)
        Removes row from index.
        Parameters:
        row - Row.
        Returns:
        True if row has been removed.
      • getDistributedMultiplier

        public final int getDistributedMultiplier​(org.h2.engine.Session ses,
                                                  org.h2.table.TableFilter[] filters,
                                                  int filter)
        Parameters:
        ses - Session.
        filters - All joined table filters.
        filter - Current filter.
        Returns:
        Multiplier.
      • getTable

        public GridH2Table getTable()
        Specified by:
        getTable in interface org.h2.index.Index
        Overrides:
        getTable in class org.h2.index.BaseIndex
      • getDiskSpaceUsed

        public long getDiskSpaceUsed()
      • checkRename

        public void checkRename()
        Specified by:
        checkRename in interface org.h2.engine.DbObject
        Specified by:
        checkRename in class org.h2.engine.DbObjectBase
      • 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)
      • needRebuild

        public boolean needRebuild()
      • segmentsCount

        public abstract int segmentsCount()
        Returns:
        Index segments count.
      • segmentForPartition

        public int segmentForPartition​(int partition)
        Parameters:
        partition - Partition idx.
        Returns:
        Segment ID for given key
      • segmentForRow

        protected int segmentForRow​(GridCacheContext ctx,
                                    org.h2.result.SearchRow row)
        Parameters:
        row - Table row.
        Returns:
        Segment ID for given row.
      • refreshColumnIds

        public void refreshColumnIds()
        Re-assign column ids after removal of column(s).
      • queryContextRegistry

        protected QueryContextRegistry queryContextRegistry()
        Returns:
        Query context registry.
      • getRowCountApproximation

        public long getRowCountApproximation()
      • totalRowCount

        public abstract long totalRowCount​(IndexingQueryCacheFilter partsFilter)
        Parameters:
        partsFilter - Partitions filter.
        Returns:
        Total row count in the current index for filtered partitions.
      • columnsArray

        @NotNull
        public static @NotNull org.h2.table.IndexColumn[] columnsArray​(GridH2Table tbl,
                                                                       List<org.h2.table.IndexColumn> colsList)
        Parameters:
        tbl - Table.
        colsList - Columns list.
        Returns:
        Index column array.
      • unwrap

        public <T extends Index> T unwrap​(Class<T> clazz)
        Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.