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

Java NamesQueryFilter类代码示例

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

本文整理汇总了Java中org.apache.cassandra.db.filter.NamesQueryFilter的典型用法代码示例。如果您正苦于以下问题:Java NamesQueryFilter类的具体用法?Java NamesQueryFilter怎么用?Java NamesQueryFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NamesQueryFilter类属于org.apache.cassandra.db.filter包,在下文中一共展示了NamesQueryFilter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCurrentValuesFromCFS

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
private void getCurrentValuesFromCFS(List<CounterUpdateCell> counterUpdateCells,
                                     ColumnFamilyStore cfs,
                                     ClockAndCount[] currentValues)
{
    SortedSet<CellName> names = new TreeSet<>(cfs.metadata.comparator);
    for (int i = 0; i < currentValues.length; i++)
        if (currentValues[i] == null)
            names.add(counterUpdateCells.get(i).name());

    ReadCommand cmd = new SliceByNamesReadCommand(getKeyspaceName(), key(), cfs.metadata.cfName, Long.MIN_VALUE, new NamesQueryFilter(names));
    Row row = cmd.getRow(cfs.keyspace);
    ColumnFamily cf = row == null ? null : row.cf;

    for (int i = 0; i < currentValues.length; i++)
    {
        if (currentValues[i] != null)
            continue;

        Cell cell = cf == null ? null : cf.getColumn(counterUpdateCells.get(i).name());
        if (cell == null || !cell.isLive()) // absent or a tombstone.
            currentValues[i] = ClockAndCount.BLANK;
        else
            currentValues[i] = CounterContext.instance().getLocalClockAndCount(cell.value());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:CounterMutation.java


示例2: testGetColumn

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testGetColumn()
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("Keyspace1", dk.getKey());
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(keyspace);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:ReadMessageTest.java


示例3: testGetColumn

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    RowMutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new RowMutation("Keyspace1", dk.key);
    rm.add("Standard1", ByteBufferUtil.bytes("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, "Standard1", System.currentTimeMillis(), new NamesQueryFilter(ByteBufferUtil.bytes("Column1")));
    Row row = command.getRow(keyspace);
    Column col = row.cf.getColumn(ByteBufferUtil.bytes("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:18,代码来源:ReadMessageTest.java


示例4: retryDummyRead

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
private void retryDummyRead(String ks, String cf) throws PermanentBackendException {

        final long limit = System.currentTimeMillis() + (60L * 1000L);

        while (System.currentTimeMillis() < limit) {
            try {
                SortedSet<ByteBuffer> ss = new TreeSet<ByteBuffer>();
                ss.add(ByteBufferUtil.zeroByteBuffer(1));
                NamesQueryFilter nqf = new NamesQueryFilter(ss);
                SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
                StorageProxy.read(ImmutableList.<ReadCommand> of(cmd), ConsistencyLevel.QUORUM);
                log.info("Read on CF {} in KS {} succeeded", cf, ks);
                return;
            } catch (Throwable t) {
                log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
            }

            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                throw new PermanentBackendException(e);
            }
        }

        throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
    }
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:27,代码来源:CassandraEmbeddedStoreManager.java


示例5: testGetColumn

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testGetColumn()
{
    Keyspace keyspace = Keyspace.open(KEYSPACE1);
    CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation(KEYSPACE1, dk.getKey());
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand(KEYSPACE1, dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(keyspace);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:19,代码来源:ReadMessageTest.java


示例6: reduceNameFilter

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
/**
 * remove columns from @param filter where we already have data in @param returnCF newer than @param sstableTimestamp
 */
private void reduceNameFilter(QueryFilter filter, ColumnFamily returnCF, long sstableTimestamp)
{
    AbstractColumnContainer container = filter.path.superColumnName == null
                                      ? returnCF
                                      : (SuperColumn) returnCF.getColumn(filter.path.superColumnName);
    if (container == null)
        return;

    for (Iterator<ByteBuffer> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); )
    {
        ByteBuffer filterColumn = iterator.next();
        IColumn column = container.getColumn(filterColumn);
        if (column != null && column.timestamp() > sstableTimestamp)
            iterator.remove();
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:CollationController.java


示例7: testGetColumn

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("Keyspace1", dk.key);
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(keyspace);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:19,代码来源:ReadMessageTest.java


示例8: getCurrentValuesFromCFS

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
private void getCurrentValuesFromCFS(List<CounterUpdateCell> counterUpdateCells,
                                     ColumnFamilyStore cfs,
                                     ClockAndCount[] currentValues)
{
    SortedSet<CellName> names = new TreeSet<>(cfs.metadata.comparator);
    for (int i = 0; i < currentValues.length; i++)
        if (currentValues[i] == null)
            names.add(counterUpdateCells.get(i).name);

    ReadCommand cmd = new SliceByNamesReadCommand(getKeyspaceName(), key(), cfs.metadata.cfName, Long.MIN_VALUE, new NamesQueryFilter(names));
    Row row = cmd.getRow(cfs.keyspace);
    ColumnFamily cf = row == null ? null : row.cf;

    for (int i = 0; i < currentValues.length; i++)
    {
        if (currentValues[i] != null)
            continue;

        Cell cell = cf == null ? null : cf.getColumn(counterUpdateCells.get(i).name());
        if (cell == null || cell.isMarkedForDelete(Long.MIN_VALUE)) // absent or a tombstone.
            currentValues[i] = ClockAndCount.BLANK;
        else
            currentValues[i] = CounterContext.instance().getLocalClockAndCount(cell.value());
    }
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:26,代码来源:CounterMutation.java


示例9: testGetColumn

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testGetColumn()
{
    Keyspace keyspace = Keyspace.open("Keyspace1");
    CellNameType type = keyspace.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("Keyspace1", dk.key);
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(keyspace);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
}
 
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:19,代码来源:ReadMessageTest.java


示例10: retryDummyRead

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
private void retryDummyRead(String ks, String cf) throws PermanentBackendException {

        final long limit = System.currentTimeMillis() + (60L * 1000L);

        while (System.currentTimeMillis() < limit) {
            try {
                SortedSet<CellName> names = new TreeSet<>(new Comparator<CellName>() {
                    // This is a singleton set.  We need to define a comparator because SimpleDenseCellName is not
                    // comparable, but it doesn't have to be a useful comparator
                    @Override
                    public int compare(CellName o1, CellName o2)
                    {
                        return 0;
                    }
                });
                names.add(CellNames.simpleDense(ByteBufferUtil.zeroByteBuffer(1)));
                NamesQueryFilter nqf = new NamesQueryFilter(names);
                SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(ks, ByteBufferUtil.zeroByteBuffer(1), cf, 1L, nqf);
                StorageProxy.read(ImmutableList.<ReadCommand> of(cmd), ConsistencyLevel.QUORUM);
                log.info("Read on CF {} in KS {} succeeded", cf, ks);
                return;
            } catch (Throwable t) {
                log.warn("Failed to read CF {} in KS {} following creation", cf, ks, t);
            }

            try {
                Thread.sleep(1000L);
            } catch (InterruptedException e) {
                throw new PermanentBackendException(e);
            }
        }

        throw new PermanentBackendException("Timed out while attempting to read CF " + cf + " in KS " + ks + " following creation");
    }
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:35,代码来源:CassandraEmbeddedStoreManager.java


示例11: getTopLevelColumns

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
public ColumnFamily getTopLevelColumns(boolean copyOnHeap)
{
    return filter.filter instanceof NamesQueryFilter
           && cfs.metadata.getDefaultValidator() != CounterColumnType.instance
           ? collectTimeOrderedData(copyOnHeap)
           : collectAllData(copyOnHeap);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:CollationController.java


示例12: reduceNameFilter

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
/**
 * remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp
 */
private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp)
{
    if (container == null)
        return;

    for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); )
    {
        CellName filterColumn = iterator.next();
        Cell cell = container.getColumn(filterColumn);
        if (cell != null && cell.timestamp() > sstableTimestamp)
            iterator.remove();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:17,代码来源:CollationController.java


示例13: create

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
public static ReadCommand create(String ksName, ByteBuffer key, String cfName, long timestamp, IDiskAtomFilter filter)
{
    if (filter instanceof SliceQueryFilter)
        return new SliceFromReadCommand(ksName, key, cfName, timestamp, (SliceQueryFilter)filter);
    else
        return new SliceByNamesReadCommand(ksName, key, cfName, timestamp, (NamesQueryFilter)filter);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:ReadCommand.java


示例14: namesFilter

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
public static NamesQueryFilter namesFilter(ColumnFamilyStore cfs, String... names)
{
    SortedSet<CellName> s = new TreeSet<CellName>(cfs.getComparator());
    for (String str : names)
        s.add(cellname(str));
    return new NamesQueryFilter(s);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:Util.java


示例15: testSliceByNamesCommandOnUUIDTypeSCF

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testSliceByNamesCommandOnUUIDTypeSCF() throws Throwable
{
    String keyspaceName = "Keyspace1";
    String cfName = "Super6";
    ByteBuffer superColName = LexicalUUIDType.instance.fromString("a4ed3562-0e8e-4b41-bdfd-c45a2774682d");
    Keyspace keyspace = Keyspace.open(keyspaceName);
    ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(cfName);
    DecoratedKey key = Util.dk("slice-get-uuid-type");

    // Insert a row with one supercolumn and multiple subcolumns
    putColsSuper(cfs, key, superColName, new BufferCell(cellname("a"), ByteBufferUtil.bytes("A"), 1),
                                         new BufferCell(cellname("b"), ByteBufferUtil.bytes("B"), 1));

    // Get the entire supercolumn like normal
    ColumnFamily cfGet = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, cfName, System.currentTimeMillis()));
    assertEquals(ByteBufferUtil.bytes("A"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfGet.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());

    // Now do the SliceByNamesCommand on the supercolumn, passing both subcolumns in as columns to get
    SortedSet<CellName> sliceColNames = new TreeSet<CellName>(cfs.metadata.comparator);
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a")));
    sliceColNames.add(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b")));
    SliceByNamesReadCommand cmd = new SliceByNamesReadCommand(keyspaceName, key.getKey(), cfName, System.currentTimeMillis(), new NamesQueryFilter(sliceColNames));
    ColumnFamily cfSliced = cmd.getRow(keyspace).cf;

    // Make sure the slice returns the same as the straight get
    assertEquals(ByteBufferUtil.bytes("A"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("a"))).value());
    assertEquals(ByteBufferUtil.bytes("B"), cfSliced.getColumn(CellNames.compositeDense(superColName, ByteBufferUtil.bytes("b"))).value());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:31,代码来源:ColumnFamilyStoreTest.java


示例16: testTruncateWithoutSnapshotNonDurable

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
@Test
public void testTruncateWithoutSnapshotNonDurable()  throws ExecutionException, InterruptedException
{
    CommitLog.instance.resetUnsafe();
    boolean prevAutoSnapshot = DatabaseDescriptor.isAutoSnapshot();
    DatabaseDescriptor.setAutoSnapshot(false);
    Keyspace notDurableKs = Keyspace.open("NoCommitlogSpace");
    Assert.assertFalse(notDurableKs.metadata.durableWrites);
    ColumnFamilyStore cfs = notDurableKs.getColumnFamilyStore("Standard1");
    CellNameType type = notDurableKs.getColumnFamilyStore("Standard1").getComparator();
    Mutation rm;
    DecoratedKey dk = Util.dk("key1");

    // add data
    rm = new Mutation("NoCommitlogSpace", dk.getKey());
    rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
    rm.apply();

    ReadCommand command = new SliceByNamesReadCommand("NoCommitlogSpace", dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
    Row row = command.getRow(notDurableKs);
    Cell col = row.cf.getColumn(Util.cellname("Column1"));
    Assert.assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));
    cfs.truncateBlocking();
    DatabaseDescriptor.setAutoSnapshot(prevAutoSnapshot);
    row = command.getRow(notDurableKs);
    Assert.assertEquals(null, row.cf);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:28,代码来源:CommitLogTest.java


示例17: getTopLevelColumns

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
public ColumnFamily getTopLevelColumns()
{
    return filter.filter instanceof NamesQueryFilter
           && cfs.metadata.getDefaultValidator() != CounterColumnType.instance
           ? collectTimeOrderedData()
           : collectAllData();
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:8,代码来源:CollationController.java


示例18: reduceNameFilter

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
/**
 * remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp
 */
private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp)
{
    if (container == null)
        return;

    for (Iterator<ByteBuffer> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); )
    {
        ByteBuffer filterColumn = iterator.next();
        Column column = container.getColumn(filterColumn);
        if (column != null && column.timestamp() > sstableTimestamp)
            iterator.remove();
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:17,代码来源:CollationController.java


示例19: getTopLevelColumns

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
public ColumnFamily getTopLevelColumns(boolean copyOnHeap)
{
	//@daidong Most of the time, we run collectAllData() function.
    return filter.filter instanceof NamesQueryFilter
           && cfs.metadata.getDefaultValidator() != CounterColumnType.instance
           ? collectTimeOrderedData(copyOnHeap)
           : collectAllData(copyOnHeap);
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:9,代码来源:CollationController.java


示例20: reduceNameFilter

import org.apache.cassandra.db.filter.NamesQueryFilter; //导入依赖的package包/类
/**
 * remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp
 */
private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp)
{
    if (container == null)
        return;

    SearchIterator<CellName, Cell> searchIter = container.searchIterator();
    for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext() && searchIter.hasNext(); )
    {
        CellName filterColumn = iterator.next();
        Cell cell = searchIter.next(filterColumn);
        if (cell != null && cell.timestamp() > sstableTimestamp)
            iterator.remove();
    }
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:18,代码来源:CollationController.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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