本文整理汇总了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);
}
示例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));
}
示例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);
}
示例4: asAbstractType
import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public AbstractType<?> asAbstractType()
{
return CompositeType.getInstance(types);
}
示例5: asAbstractType
import org.apache.cassandra.db.marshal.CompositeType; //导入方法依赖的package包/类
public AbstractType<?> asAbstractType()
{
return CompositeType.getInstance(fullType.types);
}
示例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);
}
示例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());
}
示例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));
}
示例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);
}
示例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);
}