Search in sources :

Example 1 with DefaultDseIndexMetadata

use of com.datastax.dse.driver.internal.core.metadata.schema.DefaultDseIndexMetadata in project java-driver by datastax.

the class DseTableParser 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 DseIndexMetadata 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 DefaultDseIndexMetadata(keyspaceId, tableId, name, kind, target, options);
}
Also used : IndexKind(com.datastax.oss.driver.api.core.metadata.schema.IndexKind) CqlIdentifier(com.datastax.oss.driver.api.core.CqlIdentifier) DefaultDseIndexMetadata(com.datastax.dse.driver.internal.core.metadata.schema.DefaultDseIndexMetadata)

Aggregations

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