Search in sources :

Example 1 with IndexType

use of org.apache.cassandra.thrift.IndexType in project brisk by riptano.

the class SchemaLoader method indexCFMD.

private static CFMetaData indexCFMD(String ksName, String cfName, final Boolean withIdxType) {
    return standardCFMD(ksName, cfName).columnMetadata(Collections.unmodifiableMap(new HashMap<ByteBuffer, ColumnDefinition>() {

        {
            ByteBuffer cName = ByteBuffer.wrap("birthdate".getBytes(Charsets.UTF_8));
            IndexType keys = withIdxType ? IndexType.KEYS : null;
            put(cName, new ColumnDefinition(cName, LongType.instance, keys, null));
        }
    }));
}
Also used : IndexType(org.apache.cassandra.thrift.IndexType) ByteBuffer(java.nio.ByteBuffer)

Example 2 with IndexType

use of org.apache.cassandra.thrift.IndexType in project eiger by wlloyd.

the class ColumnDefinition method fromAvro.

public static ColumnDefinition fromAvro(org.apache.cassandra.db.migration.avro.ColumnDef cd) {
    IndexType index_type = cd.index_type == null ? null : Enum.valueOf(IndexType.class, cd.index_type.name());
    String index_name = cd.index_name == null ? null : cd.index_name.toString();
    try {
        AbstractType validatorType = TypeParser.parse(cd.validation_class);
        return new ColumnDefinition(ByteBufferUtil.clone(cd.name), validatorType, index_type, getStringMap(cd.index_options), index_name);
    } catch (ConfigurationException e) {
        throw new RuntimeException(e);
    }
}
Also used : AbstractType(org.apache.cassandra.db.marshal.AbstractType) IndexType(org.apache.cassandra.thrift.IndexType)

Aggregations

IndexType (org.apache.cassandra.thrift.IndexType)2 ByteBuffer (java.nio.ByteBuffer)1 AbstractType (org.apache.cassandra.db.marshal.AbstractType)1