use of org.apache.cassandra.index.SecondaryIndexManager in project cassandra by apache.
the class SecondaryIndexTest method createAndDropIndexWithQuotedColumnIdentifier.
private void createAndDropIndexWithQuotedColumnIdentifier(String target) throws Throwable {
String indexName = "test_mixed_case_idx";
createIndex(String.format("CREATE INDEX %s ON %%s(%s)", indexName, target));
SecondaryIndexManager indexManager = getCurrentColumnFamilyStore().indexManager;
IndexMetadata indexDef = indexManager.getIndexByName(indexName).getIndexMetadata();
dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
// verify we can re-create the index using the target string
createIndex(String.format("CREATE INDEX %s ON %%s(%s)", indexName, indexDef.options.get(IndexTarget.TARGET_OPTION_NAME)));
assertEquals(indexDef, indexManager.getIndexByName(indexName).getIndexMetadata());
dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
}
use of org.apache.cassandra.index.SecondaryIndexManager in project cassandra by apache.
the class JoinTokenRingTest method testIndexPreJoinInvocation.
@Test
public void testIndexPreJoinInvocation() throws IOException {
StorageService ss = StorageService.instance;
ss.joinRing();
SecondaryIndexManager indexManager = ColumnFamilyStore.getIfExists("JoinTokenRingTestKeyspace7", "Indexed1").indexManager;
StubIndex stub = (StubIndex) indexManager.getIndexByName("Indexed1_value_index");
Assert.assertTrue(stub.preJoinInvocation);
}
use of org.apache.cassandra.index.SecondaryIndexManager in project cassandra by apache.
the class SecondaryIndexTest method createAndDropCollectionValuesIndex.
private void createAndDropCollectionValuesIndex(String columnName) throws Throwable {
String indexName = columnName + "_idx";
SecondaryIndexManager indexManager = getCurrentColumnFamilyStore().indexManager;
createIndex(String.format("CREATE INDEX %s on %%s(%s)", indexName, columnName));
IndexMetadata indexDef = indexManager.getIndexByName(indexName).getIndexMetadata();
assertEquals(String.format("values(%s)", columnName), indexDef.options.get(IndexTarget.TARGET_OPTION_NAME));
dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
assertFalse(indexManager.hasIndexes());
createIndex(String.format("CREATE INDEX %s on %%s(values(%s))", indexName, columnName));
assertEquals(indexDef, indexManager.getIndexByName(indexName).getIndexMetadata());
dropIndex(String.format("DROP INDEX %s.%s", KEYSPACE, indexName));
}
use of org.apache.cassandra.index.SecondaryIndexManager in project cassandra by apache.
the class SelectStatement method getRowFilter.
/**
* May be used by custom QueryHandler implementations
*/
public RowFilter getRowFilter(QueryOptions options) throws InvalidRequestException {
ColumnFamilyStore cfs = Keyspace.open(keyspace()).getColumnFamilyStore(columnFamily());
SecondaryIndexManager secondaryIndexManager = cfs.indexManager;
RowFilter filter = restrictions.getRowFilter(secondaryIndexManager, options);
return filter;
}
Aggregations