本文整理汇总了Java中org.apache.cassandra.db.filter.ClusteringIndexFilter类的典型用法代码示例。如果您正苦于以下问题:Java ClusteringIndexFilter类的具体用法?Java ClusteringIndexFilter怎么用?Java ClusteringIndexFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClusteringIndexFilter类属于org.apache.cassandra.db.filter包,在下文中一共展示了ClusteringIndexFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UnfilteredRowIteratorWithLowerBound
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
public UnfilteredRowIteratorWithLowerBound(DecoratedKey partitionKey,
SSTableReader sstable,
ClusteringIndexFilter filter,
ColumnFilter selectedColumns,
boolean isForThrift,
int nowInSec,
boolean applyThriftTransformation)
{
super(partitionKey);
this.sstable = sstable;
this.filter = filter;
this.selectedColumns = selectedColumns;
this.isForThrift = isForThrift;
this.nowInSec = nowInSec;
this.applyThriftTransformation = applyThriftTransformation;
this.lowerBound = null;
this.firstItemRetrieved = false;
}
示例2: isFilterFullyCoveredBy
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
public boolean isFilterFullyCoveredBy(ClusteringIndexFilter filter, DataLimits limits, CachedPartition cached, int nowInSec)
{
// We can use the cached value only if we know that no data it doesn't contain could be covered
// by the query filter, that is if:
// 1) either the whole partition is cached
// 2) or we can ensure than any data the filter selects is in the cached partition
// We can guarantee that a partition is fully cached if the number of rows it contains is less than
// what we're caching. Wen doing that, we should be careful about expiring cells: we should count
// something expired that wasn't when the partition was cached, or we could decide that the whole
// partition is cached when it's not. This is why we use CachedPartition#cachedLiveRows.
if (cached.cachedLiveRows() < metadata.params.caching.rowsPerPartitionToCache())
return true;
// If the whole partition isn't cached, then we must guarantee that the filter cannot select data that
// is not in the cache. We can guarantee that if either the filter is a "head filter" and the cached
// partition has more live rows that queried (where live rows refers to the rows that are live now),
// or if we can prove that everything the filter selects is in the cached partition based on its content.
return (filter.isHeadFilter() && limits.hasEnoughLiveData(cached, nowInSec)) || filter.isFullyCoveredBy(cached);
}
示例3: assertIndexRowTtl
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
private void assertIndexRowTtl(ColumnFamilyStore indexCfs, int indexedValue, int ttl) throws Throwable
{
DecoratedKey indexKey = indexCfs.decorateKey(ByteBufferUtil.bytes(indexedValue));
ClusteringIndexFilter filter = new ClusteringIndexSliceFilter(Slices.with(indexCfs.metadata.comparator,
Slice.ALL),
false);
SinglePartitionReadCommand command = SinglePartitionReadCommand.create(indexCfs.metadata,
FBUtilities.nowInSeconds(),
indexKey,
ColumnFilter.all(indexCfs.metadata),
filter);
try (ReadOrderGroup orderGroup = ReadOrderGroup.forCommand(command);
UnfilteredRowIterator iter = command.queryMemtableAndDisk(indexCfs, orderGroup.indexReadOpOrderGroup()))
{
while( iter.hasNext())
{
Unfiltered unfiltered = iter.next();
assert (unfiltered.isRow());
Row indexRow = (Row) unfiltered;
assertEquals(ttl, indexRow.primaryKeyLivenessInfo().ttl());
}
}
}
示例4: hasNext
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
@Override
public boolean hasNext() {
if (next != null) {
return true;
}
if (nextDoc == null) {
if (!documents.hasNext()) {
return false;
}
nextDoc = documents.next();
}
DecoratedKey key = service.decoratedKey(nextDoc.left);
NavigableSet<Clustering> clusterings = clusterings(key);
if (clusterings.isEmpty()) {
return hasNext();
}
ClusteringIndexFilter filter = new ClusteringIndexNamesFilter(clusterings, false);
UnfilteredRowIterator data = read(key, filter);
if (data.isEmpty()) {
data.close();
return hasNext();
}
next = data;
return true;
}
示例5: read
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
public UnfilteredRowIterator read(DecoratedKey key, ClusteringIndexFilter filter) {
return SinglePartitionReadCommand.create(isForThrift(), table.metadata, command.nowInSec(),
command.columnFilter(), command.rowFilter(), command.limits(), key, filter)
.queryMemtableAndDisk(table, orderGroup.baseReadOpOrderGroup());
}
示例6: makeIterator
import org.apache.cassandra.db.filter.ClusteringIndexFilter; //导入依赖的package包/类
public UnfilteredPartitionIterator makeIterator(final ReadCommand command)
{
// Due to a bug in the serialization of AbstractBounds, anything that isn't a Range is understood by pre-3.0 nodes
// as a Bound, which means IncludingExcludingBounds and ExcludingBounds responses may include keys they shouldn't.
// So filter partitions that shouldn't be included here.
boolean skipFirst = false;
boolean skipLast = false;
if (!partitions.isEmpty() && command instanceof PartitionRangeReadCommand)
{
AbstractBounds<PartitionPosition> keyRange = ((PartitionRangeReadCommand)command).dataRange().keyRange();
boolean isExcludingBounds = keyRange instanceof ExcludingBounds;
skipFirst = isExcludingBounds && !keyRange.contains(partitions.get(0).partitionKey());
skipLast = (isExcludingBounds || keyRange instanceof IncludingExcludingBounds) && !keyRange.contains(partitions.get(partitions.size() - 1).partitionKey());
}
final List<ImmutableBTreePartition> toReturn;
if (skipFirst || skipLast)
{
toReturn = partitions.size() == 1
? Collections.emptyList()
: partitions.subList(skipFirst ? 1 : 0, skipLast ? partitions.size() - 1 : partitions.size());
}
else
{
toReturn = partitions;
}
return new AbstractUnfilteredPartitionIterator()
{
private int idx;
public boolean isForThrift()
{
return true;
}
public CFMetaData metadata()
{
return command.metadata();
}
public boolean hasNext()
{
return idx < toReturn.size();
}
public UnfilteredRowIterator next()
{
ImmutableBTreePartition partition = toReturn.get(idx++);
ClusteringIndexFilter filter = command.clusteringIndexFilter(partition.partitionKey());
// Pre-3.0, we didn't have a way to express exclusivity for non-composite comparators, so all slices were
// inclusive on both ends. If we have exclusive slice ends, we need to filter the results here.
UnfilteredRowIterator iterator;
if (!command.metadata().isCompound())
iterator = filter.filter(partition.sliceableUnfilteredIterator(command.columnFilter(), filter.isReversed()));
else
iterator = partition.unfilteredIterator(command.columnFilter(), Slices.ALL, filter.isReversed());
// Wrap results with a ThriftResultMerger only if they're intended for the thrift command.
if (command.isForThrift())
return ThriftResultsMerger.maybeWrap(iterator, command.nowInSec());
else
return iterator;
}
};
}