Package org.apache.cassandra.db.filter

Examples of org.apache.cassandra.db.filter.NamesQueryFilter


                    ? ((CompositeType)metadata.comparator).types.get(superColumn == null ? 0 : 1)
                    : metadata.comparator;

            SortedSet<ByteBuffer> ss = new TreeSet<ByteBuffer>(comparator);
            ss.addAll(sp.column_names);
            filter = new NamesQueryFilter(ss);
        }
        else
        {
            filter = new SliceQueryFilter(sr.start, sr.finish, sr.reversed, sr.count);
        }
View Full Code Here


    private static int maxQueried(ReadCommand command)
    {
        if (command instanceof SliceByNamesReadCommand)
        {
            NamesQueryFilter filter = ((SliceByNamesReadCommand)command).filter;
            return filter.countCQL3Rows() ? 1 : filter.columns.size();
        }
        else
        {
            SliceQueryFilter filter = ((SliceFromReadCommand)command).filter;
            return filter.count;
View Full Code Here

            if (metadata.isSuper())
            {
                CompositeType type = (CompositeType)metadata.comparator;
                SortedSet s = new TreeSet<ByteBuffer>(parent.isSetSuper_column() ? type.types.get(1) : type.types.get(0));
                s.addAll(predicate.column_names);
                filter = SuperColumns.fromSCNamesFilter(type, parent.bufferForSuper_column(), new NamesQueryFilter(s));
            }
            else
            {
                SortedSet s = new TreeSet<ByteBuffer>(metadata.comparator);
                s.addAll(predicate.column_names);
                filter = new NamesQueryFilter(s);
            }
        }
        else
        {
            filter = toInternalFilter(metadata, parent, predicate.slice_range);
View Full Code Here

            if (metadata.isSuper())
            {
                CompositeType type = (CompositeType)metadata.comparator;
                SortedSet names = new TreeSet<ByteBuffer>(column_path.column == null ? type.types.get(0) : type.types.get(1));
                names.add(column_path.column == null ? column_path.super_column : column_path.column);
                filter = SuperColumns.fromSCNamesFilter(type, column_path.column == null ? null : column_path.bufferForSuper_column(), new NamesQueryFilter(names));
            }
            else
            {
                SortedSet<ByteBuffer> names = new TreeSet<ByteBuffer>(metadata.comparator);
                names.add(column_path.column);
                filter = new NamesQueryFilter(names);
            }

            long now = System.currentTimeMillis();
            ReadCommand command = ReadCommand.create(keyspace, key, column_path.column_family, now, filter);
View Full Code Here

                temp.clear();
            }

            // avoid changing the filter columns of the original filter
            // (reduceNameFilter removes columns that are known to be irrelevant)
            NamesQueryFilter namesFilter = (NamesQueryFilter) filter.filter;
            TreeSet<ByteBuffer> filterColumns = new TreeSet<ByteBuffer>(namesFilter.columns);
            QueryFilter reducedFilter = new QueryFilter(filter.key, filter.cfName, namesFilter.withUpdatedColumns(filterColumns), filter.timestamp);

            /* add the SSTables on disk */
            Collections.sort(view.sstables, SSTable.maxTimestampComparator);

            // read sorted sstables
View Full Code Here

                readCommand = new SliceFromReadCommand(keyspaceName, key, cfName, timestamp, filter);
            }
            else
            {
                assert !expected.isEmpty();
                readCommand = new SliceByNamesReadCommand(keyspaceName, key, cfName, timestamp, new NamesQueryFilter(ImmutableSortedSet.copyOf(metadata.comparator, expected.getColumnNames())));
            }
            List<Row> rows = read(Arrays.asList(readCommand), ConsistencyLevel.QUORUM);
            ColumnFamily current = rows.get(0).cf;
            if (!casApplies(expected, current))
            {
View Full Code Here

        ReadCommand rm, rm2;
        DecoratedKey dk = Util.dk("row1");
        long ts = System.currentTimeMillis();

        rm = new SliceByNamesReadCommand("Keyspace1", dk.key, "Standard1", ts, new NamesQueryFilter(colList));
        rm2 = serializeAndDeserializeReadMessage(rm);
        assert rm2.toString().equals(rm.toString());

        rm = new SliceFromReadCommand("Keyspace1", dk.key, "Standard1", ts, new SliceQueryFilter(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, true, 2));
        rm2 = serializeAndDeserializeReadMessage(rm);
View Full Code Here

        // 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()));
    }
View Full Code Here

                SliceQueryFilter sliceFilter = new SliceQueryFilter("key1", new QueryPath("Standard2", null, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
                ColumnFamily cf = store.getColumnFamily(sliceFilter);
                assert cf.isMarkedForDelete();
                assert cf.getColumnsMap().isEmpty();

                NamesQueryFilter namesFilter = new NamesQueryFilter("key1", new QueryPath("Standard2", null, null), "a".getBytes());
                cf = store.getColumnFamily(namesFilter);
                assert cf.isMarkedForDelete();
                assert cf.getColumnsMap().isEmpty();
            }
        };
View Full Code Here

       
        SortedSet<byte[]> cols = new TreeSet<byte[]>(new BytesType());
        cols.add(TOKEN);
        cols.add(GENERATION);
        cols.add(PARTITIONER);
        QueryFilter filter = new NamesQueryFilter(LOCATION_KEY, new QueryPath(STATUS_CF), cols);
        ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(filter);
       
        if (cf == null)
        {
            // this is either a brand new node (there will be no files), or the partitioner was changed from RP to OPP.
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.filter.NamesQueryFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.