Search in sources :

Example 1 with DefaultIndexMetadata

use of com.datastax.oss.driver.internal.core.metadata.schema.DefaultIndexMetadata in project java-driver by datastax.

the class TableParser method buildModernIndex.

// In C*>=3.0, index information is stored in a dedicated table:
// CREATE TABLE system_schema.indexes (
// keyspace_name text,
// table_name text,
// index_name text,
// kind text,
// options frozen<map<text, text>>,
// PRIMARY KEY (keyspace_name, table_name, index_name)
// ) WITH CLUSTERING ORDER BY (table_name ASC, index_name ASC)
private IndexMetadata buildModernIndex(CqlIdentifier keyspaceId, CqlIdentifier tableId, AdminRow row) {
    CqlIdentifier name = CqlIdentifier.fromInternal(row.getString("index_name"));
    IndexKind kind = IndexKind.valueOf(row.getString("kind"));
    Map<String, String> options = row.getMapOfStringToString("options");
    String target = options.get("target");
    return new DefaultIndexMetadata(keyspaceId, tableId, name, kind, target, options);
}
Also used : IndexKind(com.datastax.oss.driver.api.core.metadata.schema.IndexKind) DefaultIndexMetadata(com.datastax.oss.driver.internal.core.metadata.schema.DefaultIndexMetadata) CqlIdentifier(com.datastax.oss.driver.api.core.CqlIdentifier)

Aggregations

CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)1 IndexKind (com.datastax.oss.driver.api.core.metadata.schema.IndexKind)1 DefaultIndexMetadata (com.datastax.oss.driver.internal.core.metadata.schema.DefaultIndexMetadata)1