Class SSTableIndex

java.lang.Object
org.apache.cassandra.index.sai.disk.SSTableIndex
All Implemented Interfaces:
Comparable<SSTableIndex>
Direct Known Subclasses:
EmptyIndex, V1SSTableIndex

public abstract class SSTableIndex extends Object implements Comparable<SSTableIndex>
A reference-counted container of a SSTableReader for each column index that:
  • Manages references to the SSTable for each query
  • Exposes a version agnostic searcher onto the column index
  • Exposes the index metadata for the column index
  • Field Details

  • Constructor Details

  • Method Details

    • indexFileCacheSize

      public abstract long indexFileCacheSize()
      Returns the amount of memory occupied by the index when it is initially loaded. This is the amount of data loaded into internal memory buffers by the index and does include the class footprint overhead. It used by the index metrics.
    • getRowCount

      public abstract long getRowCount()
      Returns the number of indexed rows in the index. This comes from the index metadata created when the index was written and is used by the index metrics.
    • minSSTableRowId

      public abstract long minSSTableRowId()
      Returns the minimum indexed rowId for the index. This comes from the index metadata created when the index was written and is used by the index metrics.
    • maxSSTableRowId

      public abstract long maxSSTableRowId()
      Returns the maximum indexed rowId for the index. This comes from the index metadata created when the index was written and is used by the index metrics.
    • minTerm

      public abstract ByteBuffer minTerm()
      Returns the minimum term held in the index based on the natural sort order of the index column type comparator. It comes from the index metadata created when the index was written and is used by the index metrics and used in queries to determine whether a term, or range or terms, exists in the index.
    • maxTerm

      public abstract ByteBuffer maxTerm()
      Returns the maximum term held in the index based on the natural sort order of the index column type comparator. It comes from the index metadata created when the index was written and is used by the index metrics and used in queries to determine whether a term, or range or terms, exists in the index.
    • bounds

      public abstract AbstractBounds<PartitionPosition> bounds()
      Returns the key bounds of the index. It is created from the minimum and maximum keys held in the metadata and is used to determine whether sstable indexes overlap or not.
    • search

      public abstract List<KeyRangeIterator> search(Expression expression, AbstractBounds<PartitionPosition> keyRange, QueryContext context) throws IOException
      Perform a search on the index for a single expression and keyRange.

      The result is a List of KeyRangeIterator because there will be a KeyRangeIterator for each segment in the index. The result will never be null but may be an empty List.

      Parameters:
      expression - The Expression to be searched for
      keyRange - The AbstractBounds<PartitionPosition> defining the token range for the search
      context - The QueryContext holding the per-query state
      Returns:
      a List of KeyRangeIterators containing the results of the search
      Throws:
      IOException
    • orderBy

      public abstract List<CloseableIterator<PrimaryKeyWithScore>> orderBy(Expression orderer, AbstractBounds<PartitionPosition> keyRange, QueryContext context) throws IOException
      Throws:
      IOException
    • orderResultsBy

      public abstract List<CloseableIterator<PrimaryKeyWithScore>> orderResultsBy(QueryContext context, List<PrimaryKey> results, Expression orderer) throws IOException
      Throws:
      IOException
    • populateSegmentView

      public abstract void populateSegmentView(SimpleDataSet dataSet)
      Populates a virtual table using the index metadata owned by the index
    • internalRelease

      protected abstract void internalRelease()
    • sizeOfPerColumnComponents

      public long sizeOfPerColumnComponents()
      Returns:
      total size of per-column index components, in bytes
    • getIndexTermType

      public IndexTermType getIndexTermType()
    • getIndexIdentifier

      public IndexIdentifier getIndexIdentifier()
    • getSSTableContext

      public SSTableContext getSSTableContext()
    • getVersion

      public Version getVersion()
    • getSSTable

      public SSTableReader getSSTable()
    • reference

      public boolean reference()
    • isReleased

      public boolean isReleased()
    • releaseQuietly

      public void releaseQuietly()
    • release

      public void release()
    • markObsolete

      public void markObsolete()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(SSTableIndex index)
      Specified by:
      compareTo in interface Comparable<SSTableIndex>