Package org.apache.cassandra.db

Examples of org.apache.cassandra.db.Column


    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"),
                                             ByteBufferUtil.bytes(999)));
            RowMutation rm = new RowMutation(ksName, key);
            rm.add(extraUpdate);
            return Collections.singletonList(rm);
        }
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"),
                                             ByteBufferUtil.bytes(999)));

            int newKey = ByteBufferUtil.toInt(key) + 1000;
            RowMutation rm = new RowMutation(ksName, ByteBufferUtil.bytes(newKey));
            rm.add(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"),
                                             ByteBufferUtil.bytes(999)));

            RowMutation rm = new RowMutation(ksName, key);
            rm.add(extraUpdate);
            return Collections.singletonList(rm);
View Full Code Here

    {
        ColumnFamily baseColumnFamily;
        DataOutputBuffer bufOut = new DataOutputBuffer();
        RowMutation rm;
        Message message;
        Column column;

        /* Get the first column family from list, this is just to get past validation */
        baseColumnFamily = new ColumnFamily(CFName, "Standard",DatabaseDescriptor.getComparator(Keyspace, CFName), DatabaseDescriptor.getSubComparator(Keyspace, CFName));
       
        for(ColumnFamily cf : ColumnFamiles) {
            bufOut.reset();
            try
            {
                ColumnFamily.serializer().serializeWithIndexes(cf, bufOut);
                byte[] data = new byte[bufOut.getLength()];
                System.arraycopy(bufOut.getData(), 0, data, 0, bufOut.getLength());

                column = new Column(cf.name().getBytes("UTF-8"), data, 0, false);
                baseColumnFamily.addColumn(column);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
View Full Code Here

        byte[] cfKey = key.toString().getBytes();
        List<IColumn> cfColumns = new ArrayList<IColumn>();
        for (VALUEIN value : values)
        {
            ColumnWritable columnValue = map(value);
            cfColumns.add(new Column(columnValue.getName(), columnValue.getValue()));
        }
        context.write(cfKey, cfColumns);
    }
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(name, value));
        }
        in.close();
        return cols;
    }
View Full Code Here

    {
        Map<String, ColumnFamily> map = new HashMap<String, ColumnFamily>();
        for (String key : keys)
        {
            ColumnFamily cf = ColumnFamily.create(TABLENAME, CFNAME);
            cf.addColumn(new Column(ByteBuffer.wrap(key.getBytes()), ByteBuffer.wrap(key.getBytes()), 0));
            map.put(key, cf);
        }
        return writeSSTable(map);
    }
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

            // Right now, we will only keep columns. This works because we will
            // have all the columns a range tombstone applies to when we create
            // a snapshot. This will not be true if we go to partial incremental
            // processing
            if (atom instanceof Column) {
                Column column = (Column) atom;
                if (this.tombstoneTracker.isDeleted(column)) {
                    // If the column is deleted by the rangeTombstone, just discard
                    // it, every other column of the same name will be discarded as
                    // well, unless it is later than the range tombstone in which
                    // case the column is out of date anyway
                } else if (currentColumn == null) {
                    currentColumn = column;
                } else if (currentColumn.name().equals(column.name())) {
                    if (column.timestamp() > currentColumn.minTimestamp()) {
                        currentColumn = column;
                    }
                } else {
                    columns.add(currentColumn);
                    currentColumn = column;
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

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.