• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClusteringIndexFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:19,代码来源:UnfilteredRowIteratorWithLowerBound.java


示例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);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:ColumnFamilyStore.java


示例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());
        }
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:24,代码来源:CassandraIndexTest.java


示例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;
}
 
开发者ID:jmiddleton,项目名称:cassandra-fhir-index,代码行数:32,代码来源:FhirIndexSearcher.java


示例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());
}
 
开发者ID:jmiddleton,项目名称:cassandra-fhir-index,代码行数:6,代码来源:FhirIndexSearcher.java


示例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;
        }
    };
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:69,代码来源:ReadResponse.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ZLTextRegion类代码示例发布时间:2022-05-16
下一篇:
Java Connector类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap