Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.Column


        File tempSS = tempSSTableFile("Keyspace1", "ValuesWithQuotes");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "ValuesWithQuotes");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);

        // Add rowA
        cfamily.addColumn(null, new Column(ByteBufferUtil.bytes("data"), UTF8Type.instance.fromString("{\"foo\":\"bar\"}")));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
View Full Code Here


            {
                ColumnDef cdef = itera.next();
                ByteBuffer columnValue = columns.get(ByteBufferUtil.string(cdef.name.duplicate()));
                if (columnValue != null)
                {
                    IColumn column = new Column(cdef.name, columnValue);
                    AbstractType<?> validator = getValidatorMap(cfDef).get(column.name());
                    setTupleValue(tuple, i, cqlColumnToObj(column, cfDef), validator);
                }
                else
                    tuple.set(i, null);
                i++;
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "ValuesWithQuotes");
        ColumnFamily cfamily = ColumnFamily.create("Keyspace1", "ValuesWithQuotes");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);

        // Add rowA
        cfamily.addColumn(null, new Column(ByteBufferUtil.bytes("data"), UTF8Type.instance.fromString("{\"foo\":\"bar\"}")));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
View Full Code Here

    public static class TestTrigger implements ITrigger
    {
        public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
        {
            ColumnFamily extraUpdate = update.cloneMeShallow(ArrayBackedSortedColumns.factory, false);
            extraUpdate.addColumn(new Column(update.metadata().comparator.fromString("v2"),
                                             bytes(999)));
            return Collections.singletonList(new RowMutation(ksName, key, extraUpdate));
        }
View Full Code Here

    public static class CrossPartitionTrigger implements ITrigger
    {
        public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
        {
            ColumnFamily extraUpdate = update.cloneMeShallow(ArrayBackedSortedColumns.factory, false);
            extraUpdate.addColumn(new Column(update.metadata().comparator.fromString("v2"),
                                             bytes(999)));

            int newKey = ByteBufferUtil.toInt(key) + 1000;
            return Collections.singletonList(new RowMutation(ksName, bytes(newKey), extraUpdate));
        }
View Full Code Here

    public static class CrossTableTrigger implements ITrigger
    {
        public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update)
        {
            ColumnFamily extraUpdate = ArrayBackedSortedColumns.factory.create(ksName, otherCf);
            extraUpdate.addColumn(new Column(extraUpdate.metadata().comparator.fromString("v2"),
                                             bytes(999)));
            return Collections.singletonList(new RowMutation(ksName, key, extraUpdate));
        }
View Full Code Here

            {
                ColumnDef cdef = itera.next();
                ByteBuffer columnValue = columns.get(ByteBufferUtil.string(cdef.name.duplicate()));
                if (columnValue != null)
                {
                    Column column = new Column(cdef.name, columnValue);
                    AbstractType<?> validator = getValidatorMap(cfDef).get(column.name());
                    setTupleValue(tuple, i, cqlColumnToObj(column, cfDef), validator);
                }
                else
                    tuple.set(i, null);
                i++;
View Full Code Here

            // the read-before-write this operation requires limits its usefulness on big lists, so in practice
            // toDiscard will be small and keeping a list will be more efficient.
            List<ByteBuffer> toDiscard = ((Lists.Value)value).elements;
            for (Pair<ByteBuffer, Column> p : existingList)
            {
                Column element = p.right;
                if (toDiscard.contains(element.value()))
                    cf.addColumn(params.makeTombstone(element.name()));
            }
        }
View Full Code Here

        File tempSS = tempSSTableFile("Keyspace1", "ValuesWithQuotes");
        ColumnFamily cfamily = TreeMapBackedSortedColumns.factory.create("Keyspace1", "ValuesWithQuotes");
        SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);

        // Add rowA
        cfamily.addColumn(new Column(ByteBufferUtil.bytes("data"), UTF8Type.instance.fromString("{\"foo\":\"bar\"}")));
        writer.append(Util.dk("rowA"), cfamily);
        cfamily.clear();

        SSTableReader reader = writer.closeAndOpenReader();
View Full Code Here

        {
            byte[] name = new byte[in.readInt()];
            in.readFully(name);
            byte[] value = new byte[in.readInt()];
            in.readFully(value);
            cols.add(new Column(ByteBuffer.wrap(name), ByteBuffer.wrap(value)));
        }
        in.close();
        return cols;
    }
View Full Code Here

TOP

Related Classes of org.apache.cassandra.db.Column

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.