public synchronized Future<?> addIndexedColumn(ColumnDefinition cdef){
  if (indexesByColumn.containsKey(cdef.name.bytes))   return null;
  assert cdef.getIndexType() != null;
  SecondaryIndex index=SecondaryIndex.createInstance(baseCfs,cdef);
  if (index instanceof PerRowSecondaryIndex) {
    SecondaryIndex currentIndex=rowLevelIndexMap.get(index.getClass());
    if (currentIndex == null) {
      rowLevelIndexMap.put(index.getClass(),index);
      index.init();
    }
 else {
      index=currentIndex;
      index.addColumnDef(cdef);
      logger.info("Creating new index : {}",cdef);
    }
  }
 else {
    if (cdef.getIndexType() == IndexType.CUSTOM && index instanceof AbstractSimplePerColumnSecondaryIndex)     throw new RuntimeException("Cannot use a subclass of AbstractSimplePerColumnSecondaryIndex as a CUSTOM index, as they assume they are CFS backed");
    index.init();
  }
  indexesByColumn.put(cdef.name.bytes,index);
  indexesByName.put(index.getIndexName(),index);
  return index.buildIndexAsync();
}

public synchronized Future < ? > addIndexedColumn ( ColumnDefinition cdef ) { if ( indexesByColumn . containsKey ( cdef . name . bytes ) ) return null ; assert cdef . getIndexType ( ) != null ; SecondaryIndex index = SecondaryIndex . createInstance ( baseCfs , cdef ) ; if ( index instanceof PerRowSecondaryIndex ) { SecondaryIndex currentIndex = rowLevelIndexMap . get ( index . getClass ( ) ) ; if ( currentIndex == null ) { rowLevelIndexMap . put ( index . getClass ( ) , index ) ; index . init ( ) ; } else { index = currentIndex ; index . addColumnDef ( cdef ) ; logger . info ( "Creating new index : {}" , cdef ) ; } } else { if ( cdef . getIndexType ( ) == IndexType . CUSTOM && index instanceof AbstractSimplePerColumnSecondaryIndex ) throw new RuntimeException ( "Cannot use a subclass of AbstractSimplePerColumnSecondaryIndex as a CUSTOM index, as they assume they are CFS backed" ) ; index . init ( ) ; } indexesByColumn . put ( cdef . name . bytes , index ) ; indexesByName . put ( index . getIndexName ( ) , index ) ; return index . buildIndexAsync ( ) ; }
adds and builds a index for a column
