Cannot add a super column with Thrift
-------------------------------------

                 Key: CASSANDRA-2726
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-2726
             Project: Cassandra
          Issue Type: Bug
          Components: API
    Affects Versions: 0.7.6
            Reporter: Markus Wiesenbacher


Hi,

I have an existing SuperColumnFamily with a existing Super Column (named 
"SUB1"). Now I want to add another Super Column "SUB2" to my also existing key, 
but it doesn´t work without throwing an exception.

I am using this method

                        
                        client.set_keyspace(keyspace);

                        ColumnParent cp = new ColumnParent(column_family);
                        
cp.setSuper_column(ByteBuffer.wrap(superRowKey.getBytes(Helper.encoding)));
                        
                        ByteBuffer column_value = ByteBuffer.allocate(0);
                        if (colValue != null)
                                column_value = 
ByteBuffer.wrap(colValue.getBytes(Helper.encoding));

                        client.insert(
                                        
ByteBuffer.wrap(rowKey.getBytes(Helper.encoding)),
                                        cp,
                                        new 
Column(ByteBuffer.wrap(colName.getBytes(Helper.encoding)), column_value, 
System.currentTimeMillis()),
                                        ConsistencyLevel.ONE);


and also tried this


                client.set_keyspace(keyspace);

                List<Column> columns = new ArrayList<Column>();
                columns.add(new 
Column(ByteBuffer.wrap(colName.getBytes(Helper.encoding)), 
ByteBuffer.wrap(colValue.getBytes(Helper.encoding)), 
System.currentTimeMillis()));

                SuperColumn superColumn = new 
SuperColumn(ByteBuffer.wrap(rowKey.getBytes("UTF-8")), columns);
                ColumnOrSuperColumn columnOrSuperColumn = new 
ColumnOrSuperColumn();
                columnOrSuperColumn.setSuper_column(superColumn);

                Mutation mutation = new Mutation();
                mutation.setColumn_or_supercolumn(columnOrSuperColumn);
                
                Map<ByteBuffer, Map<String, List<Mutation>>> muts = new 
HashMap<ByteBuffer, Map<String,List<Mutation>>>();
                Map<String, List<Mutation>> mut = new HashMap<String, 
List<Mutation>>();
                List<Mutation> mu = new ArrayList<Mutation>();
                mu.add(mutation);
                mut.put(column_family, mu);
                
muts.put(ByteBuffer.wrap(key_SuperColumn.getBytes(Helper.encoding)), mut);
                
                client.batch_mutate(muts, ConsistencyLevel.ONE);


The methods are called this way:

insert("Keyspace", "SuperCF", "ROW1", "SUB1", "COL1", "VAL1");
insert("Keyspace", "SuperCF", "ROW1", "SUB2", "COL1", "VAL1");

Both don´t work and I assume it´s a bug. No exception is thrown, the new super 
column just don´t appear.

Best regards
Markus


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to