Re: deleting columns with CAS (2.0.0-beta2)

2013-07-31 Thread Kalpana Suraesh
Actually, it was pointed out to me that there's a comment in
org.apache.cassandra.service.StorageProxy#cas() that says:

// finish the paxos round w/ the desired updates
// TODO turn null updates into delete?
Commit proposal = Commit.newProposal(key, ballot, updates);

so it looks like the deletes I wanted have not been implemented yet. I'd be
interested to know if there's a bug that I can track for this, though.

Thanks,
Kalpana


On Mon, Jul 29, 2013 at 1:11 PM, Kalpana Suraesh ks4...@gmail.com wrote:

 Yep, for example, I created a simple users table and then issued a delete
 with an IF statement. i.e

 CREATE TABLE users (
  user_name varchar,
  password varchar,
  state varchar,
  PRIMARY KEY (user_name)
);
 INSERT INTO users
  (user_name, password, state)
  VALUES ('jsmith', 'ch@ngem3a', 'alive');
 DELETE password FROM users WHERE user_name = 'jsmith' IF state = 'alive';

 And note that the delete won't go through if the state is something else,
 i.e. 'dead', as expected.


 On Mon, Jul 29, 2013 at 12:58 AM, aaron morton aa...@thelastpickle.comwrote:

  I presume it can be done because conditional deletes work through CQL3.
 Out of interest where do you have an example or a reference for this?

 Cheers

 -
 Aaron Morton
 Cassandra Consultant
 New Zealand

 @aaronmorton
 http://www.thelastpickle.com

 On 26/07/2013, at 8:07 AM, Kalpana Suraesh ks4...@gmail.com wrote:

  Hi,
 
  I've been playing around with CAS (compare-and-swap) in the 2.0 beta,
 using the Thrift API. I can't at all figure out how to delete columns while
 using CAS, however. I'm able to update/insert columns by adding them to the
 list of updates that is passed as a parameter to
 org.apache.cassandra.thrift.Cassandra.Client#cas(). But there seems to be
 no indication as to how to delete.
 
  I presume it can be done because conditional deletes work through CQL3.
 However, I'm interested in using Hector/Java (particularly as CQL3 does not
 yet allow batched conditional statements).
 
  Any help would be great!
 
  Thanks,
  Kalpana




 --
 --
 Kalpana Suraesh




-- 
--
Kalpana Suraesh


Re: deleting columns with CAS (2.0.0-beta2)

2013-07-29 Thread aaron morton
 I presume it can be done because conditional deletes work through CQL3. 
Out of interest where do you have an example or a reference for this?

Cheers

-
Aaron Morton
Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 26/07/2013, at 8:07 AM, Kalpana Suraesh ks4...@gmail.com wrote:

 Hi,
 
 I've been playing around with CAS (compare-and-swap) in the 2.0 beta, using 
 the Thrift API. I can't at all figure out how to delete columns while using 
 CAS, however. I'm able to update/insert columns by adding them to the list of 
 updates that is passed as a parameter to 
 org.apache.cassandra.thrift.Cassandra.Client#cas(). But there seems to be no 
 indication as to how to delete.
 
 I presume it can be done because conditional deletes work through CQL3. 
 However, I'm interested in using Hector/Java (particularly as CQL3 does not 
 yet allow batched conditional statements).
 
 Any help would be great!
 
 Thanks,
 Kalpana



Re: deleting columns with CAS (2.0.0-beta2)

2013-07-29 Thread Kalpana Suraesh
Yep, for example, I created a simple users table and then issued a delete
with an IF statement. i.e

CREATE TABLE users (
 user_name varchar,
 password varchar,
 state varchar,
 PRIMARY KEY (user_name)
   );
INSERT INTO users
 (user_name, password, state)
 VALUES ('jsmith', 'ch@ngem3a', 'alive');
DELETE password FROM users WHERE user_name = 'jsmith' IF state = 'alive';

And note that the delete won't go through if the state is something else,
i.e. 'dead', as expected.


On Mon, Jul 29, 2013 at 12:58 AM, aaron morton aa...@thelastpickle.comwrote:

  I presume it can be done because conditional deletes work through CQL3.
 Out of interest where do you have an example or a reference for this?

 Cheers

 -
 Aaron Morton
 Cassandra Consultant
 New Zealand

 @aaronmorton
 http://www.thelastpickle.com

 On 26/07/2013, at 8:07 AM, Kalpana Suraesh ks4...@gmail.com wrote:

  Hi,
 
  I've been playing around with CAS (compare-and-swap) in the 2.0 beta,
 using the Thrift API. I can't at all figure out how to delete columns while
 using CAS, however. I'm able to update/insert columns by adding them to the
 list of updates that is passed as a parameter to
 org.apache.cassandra.thrift.Cassandra.Client#cas(). But there seems to be
 no indication as to how to delete.
 
  I presume it can be done because conditional deletes work through CQL3.
 However, I'm interested in using Hector/Java (particularly as CQL3 does not
 yet allow batched conditional statements).
 
  Any help would be great!
 
  Thanks,
  Kalpana




-- 
--
Kalpana Suraesh


deleting columns with CAS (2.0.0-beta2)

2013-07-25 Thread Kalpana Suraesh
Hi,

I've been playing around with CAS (compare-and-swap) in the 2.0 beta, using
the Thrift API. I can't at all figure out how to delete columns while using
CAS, however. I'm able to update/insert columns by adding them to the list
of updates that is passed as a parameter to
org.apache.cassandra.thrift.Cassandra.Client#cas(). But there seems to be
no indication as to how to delete.

I presume it can be done because conditional deletes work through CQL3.
However, I'm interested in using Hector/Java (particularly as CQL3 does not
yet allow batched conditional statements).

Any help would be great!

Thanks,
Kalpana