A column value is not updated via Thrift 0.2.0  API (C#)
--------------------------------------------------------

                 Key: CASSANDRA-1048
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1048
             Project: Cassandra
          Issue Type: Bug
          Components: Tools
    Affects Versions: 0.6.1
         Environment: Windows Server 2003 R2 32-bit, JRE 6, Cassandra 0.6.1, 
Thrift 0.2.0, MS VS 2008/.NET 3.5
            Reporter: Alexander S


Hello all,

Please forgive me, if the issue I am describing is not a bug, but rather my 
lack of knowledge. I have just started playing with Cassandra and at this 
moment I am stuck.

I am a .NET developer and have very little experience with Java. This is why I 
decided to use Thrift generated C# classes in order to communicate with 
Cassandra. It appears I can insert columns, but I cannot updated them using C# 
interface. At the same time I can do it successfully using cassandra-cli. Let 
me provide some details:

// Inserting column:

            long tStamp = DateTime.Now.Millisecond;

            //Insert the data into the column 'name' 
            client.insert("Keyspace1",
                          "Test",
                          nameColumnPath,
                          utf8Encoding.GetBytes("Value"),
                          tStamp,
                          ConsistencyLevel.ONE);

            ColumnOrSuperColumn returnedCol = new ColumnOrSuperColumn();

            returnedCol = client.get("Keyspace1", "Test", nameColumnPath, 
ConsistencyLevel.ONE);
            Console.WriteLine("Column Data in Keyspace1/Standard1: name: {0}, 
value: {1}",
                              utf8Encoding.GetString(returnedCol.Column.Name),
                              utf8Encoding.GetString(returnedCol.Column.Value));

// Column Data in Keyspace1/Standard1: name: name, value: Value
// update same column:

            Console.WriteLine("Update column value");
            //Insert the data into the column 'name' 
            client.insert("Keyspace1",
                          "Test",
                          nameColumnPath,
                          utf8Encoding.GetBytes("Value updated"),
                          tStamp,
                          ConsistencyLevel.ONE);

            returnedCol = client.get("Keyspace1", "Test", nameColumnPath, 
ConsistencyLevel.ONE);
            Console.WriteLine("Column Data in Keyspace1/Standard1: name: {0}, 
value: {1}",
                              utf8Encoding.GetString(returnedCol.Column.Name),
                              utf8Encoding.GetString(returnedCol.Column.Value));

//Column Data in Keyspace1/Standard1: name: name, value: Value (it has NOT been 
changed!!!)

Now I try achieve same results with cassandra-cli:

cassandra> set Keyspace1.Standard1['Test']['name']='Value'
Value inserted.
cassandra> get Keyspace1.Standard1['Test']
=> (column=6e616d65, value=Value, timestamp=1272932956231000)
Returned 1 results.
cassandra> set Keyspace1.Standard1['Test']['name']='Value updated'
Value inserted.
cassandra> get Keyspace1.Standard1['Test']
=> (column=6e616d65, value=Value updated, timestamp=1272932970637000)
Returned 1 results.
cassandra>

As you can see it works. 

It doesn't matter if timestamps values are different for C# example. I tried it 
too.

Thank you very much.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to