Package org.apache.cassandra.thrift

Examples of org.apache.cassandra.thrift.SlicePredicate


    private static SlicePredicate predicateFromString(String st)
    {
        assert st != null;
        TDeserializer deserializer = new TDeserializer(new TJSONProtocol.Factory());
        SlicePredicate predicate = new SlicePredicate();
        try
        {
            deserializer.deserialize(predicate, st, "UTF-8");
        }
        catch (TException e)
View Full Code Here


                new Column(getBytes(4), ByteBufferUtil.bytes("val4"), 1),
                new Column(getBytes(5), ByteBufferUtil.bytes("val5"), 1),
                new Column(getBytes(6), ByteBufferUtil.bytes("val6"), 1));
       
        // verify insert.
        final SlicePredicate sp = new SlicePredicate();
        sp.setSlice_range(new SliceRange());
        sp.getSlice_range().setCount(100);
        sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY);
        sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY);
       
        assertRowAndColCount(1, 6, scfName, false, cfs.getRangeSlice(scfName, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator())));
       
        // deeleet.
        RowMutation rm = new RowMutation(table.name, key.key);
View Full Code Here

        String cfName = "Standard1";
        Table table = Table.open(tableName);
        ColumnFamilyStore cfs = table.getColumnFamilyStore(cfName);
        DecoratedKey key = Util.dk("f-flush-resurrection");
       
        SlicePredicate sp = new SlicePredicate();
        sp.setSlice_range(new SliceRange());
        sp.getSlice_range().setCount(100);
        sp.getSlice_range().setStart(ArrayUtils.EMPTY_BYTE_ARRAY);
        sp.getSlice_range().setFinish(ArrayUtils.EMPTY_BYTE_ARRAY);
       
        // insert
        putColsStandard(cfs, key, column("col1", "val1", 1), column("col2", "val2", 1));
        assertRowAndColCount(1, 2, null, false, cfs.getRangeSlice(null, Util.range("f", "g"), 100, QueryFilter.getFilter(sp, cfs.getComparator())));
       
View Full Code Here

    private List<Row> multiRangeSlice(List<ByteBuffer> variables) throws InvalidRequestException, TimedOutException, UnavailableException
    {
        List<Row> rows;

        // XXX: Our use of Thrift structs internally makes me Sad. :(
        SlicePredicate thriftSlicePredicate = makeSlicePredicate(variables);
        QueryProcessor.validateSlicePredicate(cfDef.cfm, thriftSlicePredicate);

        List<IndexExpression> expressions = getIndexExpressions(variables);

        try
View Full Code Here

    }

    private SlicePredicate makeSlicePredicate(List<ByteBuffer> variables)
    throws InvalidRequestException
    {
        SlicePredicate thriftSlicePredicate = new SlicePredicate();

        if (isColumnRange())
        {
            SliceRange sliceRange = new SliceRange();
            sliceRange.start = getRequestedBound(Bound.START, variables);
View Full Code Here

            String columnFamily = in.readUTF();

            TDeserializer dser = new TDeserializer(new TBinaryProtocol.Factory());
            IndexClause indexClause = new IndexClause();
            FBUtilities.deserialize(dser, indexClause, in);
            SlicePredicate predicate = new SlicePredicate();
            FBUtilities.deserialize(dser, predicate, in);
            AbstractBounds range = AbstractBounds.serializer().deserialize(in);

            return new IndexScanCommand(keyspace, columnFamily, indexClause, predicate, range);
        }
View Full Code Here

        this.cfName = cfName;
    }

    public List<KeySlice> indexGet(ByteBuffer columnName, ByteBuffer value, ByteBuffer startOffset, int limit, boolean isReverse) throws Exception
    {
        SlicePredicate predicate = new SlicePredicate().setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, isReverse, limit));
        ColumnParent parent = new ColumnParent(cfName);
        IndexExpression expression = new IndexExpression(columnName, IndexOperator.EQ, value);
        IndexClause clause = new IndexClause(Arrays.asList(expression), startOffset, limit);
        return client.get_indexed_slices(parent, clause, predicate, cl);
    }
View Full Code Here

        return client.get_indexed_slices(parent, clause, predicate, cl);
    }

    public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiGet(List<ByteBuffer> keys, int limit) throws Exception
    {
        SlicePredicate predicate = new SlicePredicate().setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, limit));
        ColumnParent parent = new ColumnParent(cfName);
        return client.multiget_slice(keys, parent, predicate, cl);
    }
View Full Code Here

        return client.multiget_slice(keys, parent, predicate, cl);
    }

    public List<KeySlice> getRangeSlice(ByteBuffer start, ByteBuffer end, int limit) throws Exception
    {
        SlicePredicate predicate = new SlicePredicate().setSlice_range(new SliceRange(ByteBufferUtil.EMPTY_BYTE_BUFFER, ByteBufferUtil.EMPTY_BYTE_BUFFER, false, limit));
        ColumnParent parent = new ColumnParent(cfName);
        KeyRange range = new KeyRange(limit).setStart_key(start).setEnd_key(end);
        return client.get_range_slices(parent, predicate, range, cl);
    }
View Full Code Here

    public List<ColumnOrSuperColumn> getSlice(ByteBuffer key, ByteBuffer start, ByteBuffer end, int limit, boolean isReverse) throws Exception
    {
        SliceRange sliceRange = new SliceRange().setStart(start).setFinish(end).setReversed(isReverse).setCount(limit);
        // initialize SlicePredicate with existing SliceRange
        SlicePredicate predicate = new SlicePredicate().setSlice_range(sliceRange);
        ColumnParent parent = new ColumnParent(cfName);
        return client.get_slice(key, parent, predicate, cl);
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.thrift.SlicePredicate

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.