Class SSTableIndex
- java.lang.Object
-
- org.apache.cassandra.index.sai.disk.SSTableIndex
-
- All Implemented Interfaces:
SegmentOrdering
- Direct Known Subclasses:
V1SSTableIndex
public abstract class SSTableIndex extends java.lang.Object implements SegmentOrdering
A reference-counted container of aSSTableReader
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 Summary
Fields Modifier and Type Field Description static java.util.Comparator<SSTableIndex>
COMPARATOR
protected IndexIdentifier
indexIdentifier
protected IndexTermType
indexTermType
protected SSTableContext
sstableContext
-
Constructor Summary
Constructors Constructor Description SSTableIndex(SSTableContext sstableContext, StorageAttachedIndex index)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AbstractBounds<PartitionPosition>
bounds()
Returns the key bounds of the index.boolean
equals(java.lang.Object o)
IndexIdentifier
getIndexIdentifier()
IndexTermType
getIndexTermType()
abstract long
getRowCount()
Returns the number of indexed rows in the index.SSTableReader
getSSTable()
SSTableContext
getSSTableContext()
Version
getVersion()
int
hashCode()
abstract long
indexFileCacheSize()
Returns the amount of memory occupied by the index when it is initially loaded.protected abstract void
internalRelease()
boolean
isReleased()
void
markObsolete()
abstract long
maxSSTableRowId()
Returns the maximum indexed rowId for the index.abstract java.nio.ByteBuffer
maxTerm()
Returns the maximum term held in the index based on the natural sort order of the index column type comparator.abstract long
minSSTableRowId()
Returns the minimum indexed rowId for the index.abstract java.nio.ByteBuffer
minTerm()
Returns the minimum term held in the index based on the natural sort order of the index column type comparator.abstract void
populateSegmentView(SimpleDataSet dataSet)
Populates a virtual table using the index metadata owned by the indexboolean
reference()
void
release()
void
releaseQuietly()
abstract java.util.List<KeyRangeIterator>
search(Expression expression, AbstractBounds<PartitionPosition> keyRange, QueryContext context)
Perform a search on the index for a single expression and keyRange.long
sizeOfPerColumnComponents()
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.cassandra.index.sai.disk.v1.segment.SegmentOrdering
limitToTopKResults
-
-
-
-
Field Detail
-
COMPARATOR
public static final java.util.Comparator<SSTableIndex> COMPARATOR
-
sstableContext
protected final SSTableContext sstableContext
-
indexTermType
protected final IndexTermType indexTermType
-
indexIdentifier
protected final IndexIdentifier indexIdentifier
-
-
Constructor Detail
-
SSTableIndex
public SSTableIndex(SSTableContext sstableContext, StorageAttachedIndex index)
-
-
Method Detail
-
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 java.nio.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 java.nio.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 java.util.List<KeyRangeIterator> search(Expression expression, AbstractBounds<PartitionPosition> keyRange, QueryContext context) throws java.io.IOException
Perform a search on the index for a single expression and keyRange.The result is a
List
ofKeyRangeIterator
because there will be aKeyRangeIterator
for each segment in the index. The result will never be null but may be an emptyList
.- Parameters:
expression
- TheExpression
to be searched forkeyRange
- TheAbstractBounds<PartitionPosition>
defining the token range for the searchcontext
- TheQueryContext
holding the per-query state- Returns:
- a
List
ofKeyRangeIterator
s containing the results of the search - Throws:
java.io.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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-