Class SkinnyPrimaryKeyMap
java.lang.Object
org.apache.cassandra.index.sai.disk.v1.SkinnyPrimaryKeyMap
- All Implemented Interfaces:
Closeable,AutoCloseable,PrimaryKeyMap
- Direct Known Subclasses:
WidePrimaryKeyMap
A
PrimaryKeyMap for skinny tables (those with no clustering columns).
This uses the following on-disk structures:
- A block-packed structure for rowId to token value lookups using
BlockPackedReader. Uses theIndexComponent.ROW_TO_TOKENcomponent - A monotonic block packed structure for rowId to partitionId lookups using
MonotonicBlockPackedReader. Uses theIndexComponent.ROW_TO_PARTITIONcomponent - A key store for rowId to
PrimaryKeyandPrimaryKeyto rowId lookups usingKeyLookup. Uses theIndexComponent.PARTITION_KEY_BLOCKSandIndexComponent.PARTITION_KEY_BLOCK_OFFSETScomponents
SkinnyPrimaryKeyMap.Factory is threadsafe, individual instances of the SkinnyPrimaryKeyMap
are not.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final KeyLookup.Cursorprotected final PrimaryKey.Factoryprotected final LongArrayprotected final LongArrayprotected final SSTableId -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSkinnyPrimaryKeyMap(LongArray rowIdToTokenArray, LongArray rowIdToPartitionIdArray, KeyLookup.Cursor partitionKeyCursor, PrimaryKey.Factory primaryKeyFactory, SSTableId sstableId) -
Method Summary
Modifier and TypeMethodDescriptionlongvoidclose()longReturns theSSTableIdassociated with thisPrimaryKeyMapprimaryKeyFromRowId(long sstableRowId) Returns aPrimaryKeyfor a row IDprotected DecoratedKeyreadPartitionKey(long sstableRowId) longrowIdFromPrimaryKey(PrimaryKey primaryKey) Returns a row ID for aPrimaryKeyprotected longtokenCollisionDetection(PrimaryKey primaryKey, long rowId)
-
Field Details
-
rowIdToTokenArray
-
rowIdToPartitionIdArray
-
partitionKeyCursor
-
-
sstableId
-
-
Constructor Details
-
SkinnyPrimaryKeyMap
protected SkinnyPrimaryKeyMap(LongArray rowIdToTokenArray, LongArray rowIdToPartitionIdArray, KeyLookup.Cursor partitionKeyCursor, PrimaryKey.Factory primaryKeyFactory, SSTableId sstableId)
-
-
Method Details
-
getSSTableId
Description copied from interface:PrimaryKeyMapReturns theSSTableIdassociated with thisPrimaryKeyMap- Specified by:
getSSTableIdin interfacePrimaryKeyMap- Returns:
- an
SSTableId
-
primaryKeyFromRowId
Description copied from interface:PrimaryKeyMapReturns aPrimaryKeyfor a row ID- Specified by:
primaryKeyFromRowIdin interfacePrimaryKeyMap- Parameters:
sstableRowId- the row ID to lookup- Returns:
- the
PrimaryKeyassociated with the row ID
-
rowIdFromPrimaryKey
Description copied from interface:PrimaryKeyMapReturns a row ID for aPrimaryKey- Specified by:
rowIdFromPrimaryKeyin interfacePrimaryKeyMap- Parameters:
primaryKey- thePrimaryKeyto lookup- Returns:
- the row ID associated with the
PrimaryKey
-
ceiling
Description copied from interface:PrimaryKeyMapReturns the first row ID of the nearestTokengreater than or equal to the givenToken, or a negative value if not found- Specified by:
ceilingin interfacePrimaryKeyMap- Parameters:
token- theTokento lookup- Returns:
- the ceiling row ID associated with the
Tokenor a negative value
-
floor
Description copied from interface:PrimaryKeyMapReturns the last row ID of the nearestTokenless than or equal to the givenToken, or a negative value if theTokenis at its minimum value- Specified by:
floorin interfacePrimaryKeyMap- Parameters:
token- theTokento lookup- Returns:
- the floor row ID associated with the
Token
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfacePrimaryKeyMap
-
tokenCollisionDetection
-
readPartitionKey
-