org.apache.cassandra.db.index.composites

## Class CompositesIndexOnPartitionKey

- java.lang.Object
- - org.apache.cassandra.db.index.SecondaryIndex
  - - org.apache.cassandra.db.index.PerColumnSecondaryIndex
    - - org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex
      - - org.apache.cassandra.db.index.composites.CompositesIndex
        - - org.apache.cassandra.db.index.composites.CompositesIndexOnPartitionKey

-     public class CompositesIndexOnPartitionKey
      extends CompositesIndex

  Index on a PARTITION_KEY column definition. This suppose a composite row key: rk = rk_0 ... rk_n The corresponding index entry will be: - index row key will be rk_i (where i == columnDef.componentIndex) - cell name will be: rk ck where rk is the fully partition key and ck the clustering keys of the original cell names (thus excluding the last column name as we want to refer to the whole CQL3 row, not just the cell itself) Note that contrarily to other type of index, we repeat the indexed value in the index cell name (we use the whole partition key). The reason is that we want to order the index cell name by partitioner first, and skipping a part of the row key would change the order.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.cassandra.db.index.composites.CompositesIndex

      `CompositesIndex.IndexedEntry`

  - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

      `columnDef, indexCfs`

    - ### Fields inherited from class org.apache.cassandra.db.index.SecondaryIndex

      `baseCfs, columnDefs, CUSTOM_INDEX_OPTION_NAME, INDEX_ENTRIES_OPTION_NAME, INDEX_KEYS_OPTION_NAME, INDEX_VALUES_OPTION_NAME, keyComparator, logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositesIndexOnPartitionKey()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static CellNameType` | `buildIndexComparator(CFMetaData baseMetadata, ColumnDefinition columnDef)`
    `CompositesIndex.IndexedEntry` | `decodeEntry(DecoratedKey indexedValue, Cell indexEntry)`
    `void` | `delete(java.nio.ByteBuffer rowKey, Cell cell, OpOrder.Group opGroup)` Called when a column has been tombstoned or replaced.
    `protected java.nio.ByteBuffer` | `getIndexedValue(java.nio.ByteBuffer rowKey, Cell cell)`
    `boolean` | `indexes(CellName name)` Returns true if the provided cell name is indexed by this secondary index.
    `boolean` | `isStale(CompositesIndex.IndexedEntry entry, ColumnFamily data, long now)`
    `protected Composite` | `makeIndexColumnPrefix(java.nio.ByteBuffer rowKey, Composite columnName)`

    - ### Methods inherited from class org.apache.cassandra.db.index.composites.CompositesIndex

      `create, createSecondaryIndexSearcher, delete, getExpressionComparator, getIndexComparator, getIndexComparator, makeIndexColumnName, validateOptions`

    - ### Methods inherited from class org.apache.cassandra.db.index.AbstractSimplePerColumnSecondaryIndex

      `deleteForCleanup, estimateResultRows, expressionString, forceBlockingFlush, getIndexCfs, getIndexKeyComparator, getIndexName, init, insert, invalidate, reload, removeIndex, truncateBlocking, update, validate`

    - ### Methods inherited from class org.apache.cassandra.db.index.PerColumnSecondaryIndex

      `getNameForSystemKeyspace, validate`

    - ### Methods inherited from class org.apache.cassandra.db.index.SecondaryIndex

      `buildIndexAsync, buildIndexBlocking, createInstance, getBaseCfs, getColumnDefs, getIndexKeyFor, indexes, isIndexBuilt, isQueryable, setIndexBuilt, setIndexRemoved, supportsOperator, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CompositesIndexOnPartitionKey

          public CompositesIndexOnPartitionKey()

  - ### Method Detail

    - #### buildIndexComparator

          public static CellNameType buildIndexComparator(CFMetaData baseMetadata,
                                                          ColumnDefinition columnDef)

    - #### getIndexedValue

          protected java.nio.ByteBuffer getIndexedValue(java.nio.ByteBuffer rowKey,
                                                        Cell cell)

      Specified by:
        `getIndexedValue` in class `AbstractSimplePerColumnSecondaryIndex`

    - #### makeIndexColumnPrefix

          protected Composite makeIndexColumnPrefix(java.nio.ByteBuffer rowKey,
                                                    Composite columnName)

      Specified by:
        `makeIndexColumnPrefix` in class `CompositesIndex`

    - #### decodeEntry

          public CompositesIndex.IndexedEntry decodeEntry(DecoratedKey indexedValue,
                                                          Cell indexEntry)

      Specified by:
        `decodeEntry` in class `CompositesIndex`

    - #### indexes

          public boolean indexes(CellName name)

      Description copied from class: `SecondaryIndex`
      Returns true if the provided cell name is indexed by this secondary index. The default implementation checks whether the name is one the columnDef name, but this should be overriden but subclass if needed.
      Specified by:
        `indexes` in class `SecondaryIndex`

    - #### isStale

          public boolean isStale(CompositesIndex.IndexedEntry entry,
                                 ColumnFamily data,
                                 long now)

      Specified by:
        `isStale` in class `CompositesIndex`

    - #### delete

          public void delete(java.nio.ByteBuffer rowKey,
                             Cell cell,
                             OpOrder.Group opGroup)

      Description copied from class: `PerColumnSecondaryIndex`
      Called when a column has been tombstoned or replaced.
      Overrides:
        `delete` in class `AbstractSimplePerColumnSecondaryIndex`
      Parameters:
        `rowKey` - the underlying row key which is indexed
        `cell` - all the column info

Copyright © 2018 The Apache Software Foundation