本文整理汇总了Java中org.apache.cassandra.db.index.SecondaryIndexSearcher类的典型用法代码示例。如果您正苦于以下问题:Java SecondaryIndexSearcher类的具体用法?Java SecondaryIndexSearcher怎么用?Java SecondaryIndexSearcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SecondaryIndexSearcher类属于org.apache.cassandra.db.index包,在下文中一共展示了SecondaryIndexSearcher类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: estimateResultRowsPerRange
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
/**
* Estimate the number of result rows (either cql3 rows or storage rows, as called for by the command) per
* range in the ring based on our local data. This assumes that ranges are uniformly distributed across the cluster
* and that the queried data is also uniformly distributed.
*/
private static float estimateResultRowsPerRange(AbstractRangeCommand command, Keyspace keyspace)
{
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.columnFamily);
float resultRowsPerRange = Float.POSITIVE_INFINITY;
if (command.rowFilter != null && !command.rowFilter.isEmpty())
{
List<SecondaryIndexSearcher> searchers = cfs.indexManager.getIndexSearchersForQuery(command.rowFilter);
if (searchers.isEmpty())
{
resultRowsPerRange = calculateResultRowsUsingEstimatedKeys(cfs);
}
else
{
// Secondary index query (cql3 or otherwise). Estimate result rows based on most selective 2ary index.
for (SecondaryIndexSearcher searcher : searchers)
{
// use our own mean column count as our estimate for how many matching rows each node will have
SecondaryIndex highestSelectivityIndex = searcher.highestSelectivityIndex(command.rowFilter);
resultRowsPerRange = Math.min(resultRowsPerRange, highestSelectivityIndex.estimateResultRows());
}
}
}
else if (!command.countCQL3Rows())
{
// non-cql3 query
resultRowsPerRange = cfs.estimateKeys();
}
else
{
resultRowsPerRange = calculateResultRowsUsingEstimatedKeys(cfs);
}
// adjust resultRowsPerRange by the number of tokens this node has and the replication factor for this ks
return (resultRowsPerRange / DatabaseDescriptor.getNumTokens()) / keyspace.getReplicationStrategy().getReplicationFactor();
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:41,代码来源:StorageProxy.java
示例2: estimateResultRowsPerRange
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
/**
* Estimate the number of result rows (either cql3 rows or storage rows, as called for by the command) per
* range in the ring based on our local data. This assumes that ranges are uniformly distributed across the cluster
* and that the queried data is also uniformly distributed.
*/
private static float estimateResultRowsPerRange(AbstractRangeCommand command, Keyspace keyspace)
{
ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(command.columnFamily);
float resultRowsPerRange;
if (command.rowFilter != null && !command.rowFilter.isEmpty())
{
// secondary index query (cql3 or otherwise)
SecondaryIndexSearcher searcher = Iterables.getOnlyElement(cfs.indexManager.getIndexSearchersForQuery(command.rowFilter));
SecondaryIndex highestSelectivityIndex = searcher.highestSelectivityIndex(command.rowFilter);
// use our own mean column count as our estimate for how many matching rows each node will have
resultRowsPerRange = highestSelectivityIndex.estimateResultRows();
}
else if (!command.countCQL3Rows())
{
// non-cql3 query
resultRowsPerRange = cfs.estimateKeys();
}
else
{
if (cfs.metadata.comparator.isDense())
{
// one storage row per result row, so use key estimate directly
resultRowsPerRange = cfs.estimateKeys();
}
else
{
float resultRowsPerStorageRow = ((float) cfs.getMeanColumns()) / cfs.metadata.regularColumns().size();
resultRowsPerRange = resultRowsPerStorageRow * (cfs.estimateKeys());
}
}
// adjust resultRowsPerRange by the number of tokens this node has and the replication factor for this ks
return (resultRowsPerRange / DatabaseDescriptor.getNumTokens()) / keyspace.getReplicationStrategy().getReplicationFactor();
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:40,代码来源:StorageProxy.java
示例3: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
public SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
{
return new CompositesSearcher(baseCfs.indexManager, columns);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:CompositesIndex.java
示例4: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
public SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
{
return new KeysSearcher(baseCfs.indexManager, columns);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:KeysIndex.java
示例5: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
{
return null;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:SecondaryIndexCellSizeTest.java
示例6: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
@Override
protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
{
return null;
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:6,代码来源:SecondaryIndexColumnSizeTest.java
示例7: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
public SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns)
{
return new CompositesSearcher(baseCfs.indexManager, columns, prefixSize);
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:5,代码来源:CompositesIndex.java
示例8: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
@Override
protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) {
Log.debug("Creating searcher for index %s", logName);
return new RowIndexSearcher(secondaryIndexManager, this, columns, rowService);
}
开发者ID:Stratio,项目名称:stratio-cassandra,代码行数:6,代码来源:RowIndex.java
示例9: createSecondaryIndexSearcher
import org.apache.cassandra.db.index.SecondaryIndexSearcher; //导入依赖的package包/类
@Override
protected SecondaryIndexSearcher createSecondaryIndexSearcher(Set<ByteBuffer> columns) {
logger.info("Fake PerColumnLuceneIdx createSecondaryIndexSearcher method");
return null;
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:6,代码来源:PerColumnLuceneIdx.java
注:本文中的org.apache.cassandra.db.index.SecondaryIndexSearcher类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论