当前位置: 首页>>代码示例>>Java>>正文


Java CompositeType.getInstance方法代码示例

本文整理汇总了Java中org.apache.cassandra.db.marshal.CompositeType.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java CompositeType.getInstance方法的具体用法?Java CompositeType.getInstance怎么用?Java CompositeType.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.db.marshal.CompositeType的用法示例。


在下文中一共展示了CompositeType.getInstance方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeNext

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
protected Pair<ByteBuffer, SortedMap<ByteBuffer, Cell>> computeNext()
{
    maybeInit();
    if (rows == null)
        return endOfData();

    totalRead++;
    KeySlice ks = rows.get(i++);
    AbstractType<?> comp = isSuper ? CompositeType.getInstance(comparator, subComparator) : comparator;
    SortedMap<ByteBuffer, Cell> map = new TreeMap<ByteBuffer, Cell>(comp);
    for (ColumnOrSuperColumn cosc : ks.columns)
    {
        List<Cell> cells = unthriftify(cosc);
        for (Cell cell : cells)
            map.put(cell.name().toByteBuffer(), cell);
    }
    return Pair.create(ks.key, map);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:ColumnFamilyRecordReader.java

示例2: defineSchema

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
@BeforeClass
public static void defineSchema() throws ConfigurationException
{
    SchemaLoader.prepareServer();
    AbstractType<?> compositeMaxMin = CompositeType.getInstance(Arrays.asList(new AbstractType<?>[]{BytesType.instance, IntegerType.instance}));
    SchemaLoader.createKeyspace(KEYSPACE1,
                                SimpleStrategy.class,
                                KSMetaData.optsWithRF(1),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD1),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARD2),
                                SchemaLoader.standardCFMD(KEYSPACE1, CF_STANDARDLONG),
                                CFMetaData.denseCFMetaData(KEYSPACE1, CF_STANDARDCOMPOSITE2, compositeMaxMin));
    SchemaLoader.createKeyspace(KEYSPACE2,
                                SimpleStrategy.class,
                                KSMetaData.optsWithRF(1),
                                SchemaLoader.standardCFMD(KEYSPACE2, CF_STANDARD3));
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:18,代码来源:KeyspaceTest.java

示例3: KeyMapper

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
/**
 * Constructor specifying the partition and clustering key mappers.
 *
 * @param metadata
 *            the indexed table metadata
 */
public KeyMapper(CFMetaData metadata) {
	this.metadata = metadata;
	clusteringComparator = metadata.comparator;
	clusteringType = CompositeType.getInstance(clusteringComparator.subtypes());
	type = CompositeType.getInstance(LongType.instance, metadata.getKeyValidator(), clusteringType);
}
 
开发者ID:jmiddleton,项目名称:cassandra-fhir-index,代码行数:13,代码来源:KeyMapper.java

示例4: asAbstractType

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public AbstractType<?> asAbstractType()
{
    return CompositeType.getInstance(types);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:CompoundCType.java

示例5: asAbstractType

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public AbstractType<?> asAbstractType()
{
    return CompositeType.getInstance(fullType.types);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:AbstractCompoundCellNameType.java

示例6: testLimitSSTablesComposites

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
@Test
public void testLimitSSTablesComposites()
{
    /*
    creates 10 sstables, composite columns like this:
    ---------------------
    k   |a0:0|a1:1|..|a9:9
    ---------------------
    ---------------------
    k   |a0:10|a1:11|..|a9:19
    ---------------------
    ...
    ---------------------
    k   |a0:90|a1:91|..|a9:99
    ---------------------
    then we slice out col1 = a5 and col2 > 85 -> which should let us just check 2 sstables and get 2 columns
     */
    Keyspace keyspace = Keyspace.open("Keyspace1");

    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore("StandardComposite2");
    cfs.disableAutoCompaction();

    CompositeType ct = CompositeType.getInstance(BytesType.instance, IntegerType.instance);
    DecoratedKey key = Util.dk("k");
    for (int j = 0; j < 10; j++)
    {
        for (int i = 0; i < 10; i++)
        {
            RowMutation rm = new RowMutation("Keyspace1", key.key);
            ByteBuffer colName = ct.builder().add(ByteBufferUtil.bytes("a" + i)).add(ByteBufferUtil.bytes(j*10 + i)).build();
            rm.add("StandardComposite2", colName, ByteBufferUtil.EMPTY_BYTE_BUFFER, 0);
            rm.apply();
        }
        cfs.forceBlockingFlush();
    }
    ByteBuffer start = ct.builder().add(ByteBufferUtil.bytes("a5")).add(ByteBufferUtil.bytes(85)).build();
    ByteBuffer finish = ct.builder().add(ByteBufferUtil.bytes("a5")).buildAsEndOfRange();
    cfs.metric.sstablesPerReadHistogram.clear();
    ColumnFamily cf = cfs.getColumnFamily(key, start, finish, false, 1000, System.currentTimeMillis());
    int colCount = 0;
    for (Column c : cf)
        colCount++;
    assertEquals(2, colCount);
    assertEquals(2, cfs.metric.sstablesPerReadHistogram.max(), 0.1);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:46,代码来源:KeyspaceTest.java

示例7: getIndexedValueType

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public AbstractType<?> getIndexedValueType(ColumnDefinition indexedColumn)
{
    CollectionType colType = (CollectionType)indexedColumn.type;
    return CompositeType.getInstance(colType.nameComparator(), colType.valueComparator());
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:6,代码来源:CassandraIndexFunctions.java

示例8: makeRawAbstractType

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
private static AbstractType<?> makeRawAbstractType(AbstractType<?> comparator, AbstractType<?> subComparator)
{
    return subComparator == null ? comparator : CompositeType.getInstance(Arrays.asList(comparator, subComparator));
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:5,代码来源:CFMetaData.java

示例9: compositeCFMD

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
private static CFMetaData compositeCFMD(String ksName, String cfName, AbstractType<?>... types) {
    return new CFMetaData(ksName, cfName, ColumnFamilyType.Standard,
            CompositeType.getInstance(Arrays.asList(types)), null);
}
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:5,代码来源:AosEmbeddedSchemaLoader.java

示例10: FullKeyMapper

import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
/**
 * Returns a new {@link FullKeyMapper} using the specified column family metadata.
 *
 * @param partitionKeyMapper  A {@link PartitionKeyMapper}.
 * @param clusteringKeyMapper A {@link ClusteringKeyMapper}.
 */
private FullKeyMapper(PartitionKeyMapper partitionKeyMapper, ClusteringKeyMapper clusteringKeyMapper) {
    AbstractType<?> partitionKeyType = partitionKeyMapper.getType();
    AbstractType<?> clusteringKeyType = clusteringKeyMapper.getType().asAbstractType();
    type = CompositeType.getInstance(partitionKeyType, clusteringKeyType);
}
 
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:12,代码来源:FullKeyMapper.java


注:本文中的org.apache.cassandra.db.marshal.CompositeType.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。