incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DuyHai Doan <doanduy...@gmail.com>
Subject Re: CQL3 delete using < or > ?
Date Sun, 09 Feb 2014 09:36:13 GMT
Hello Clint

Deletion in CQL3 using inequality on clustering columns is technically
possible on server side with RangeTombsone.

Unfortunately this is not exposed as API neither in Thrift nor in CQL3.

Create a JIRA to ask for this feature if it is critical for you.

Regards

Duy Hai DOAN
Le 9 févr. 2014 03:09, "Clint Kelly" <clint.kelly@gmail.com> a écrit :

> Folks,
>
> Is there any way to perform a delete in CQL of all rows where a
> particular columns (that is part of the primary key) is less than a
> certain value?  I believe that the corresponding SELECT statement
> works, as in this example:
>
> cqlsh:fiddle> describe table foo;
>
> CREATE TABLE foo (
>   key text,
>   fam text,
>   qual text,
>   version int,
>   val text,
>   PRIMARY KEY (key, fam, qual, version)
> ) WITH
>   bloom_filter_fp_chance=0.010000 AND
>   caching='KEYS_ONLY' AND
>   comment='' AND
>   dclocal_read_repair_chance=0.000000 AND
>   gc_grace_seconds=864000 AND
>   index_interval=128 AND
>   read_repair_chance=0.100000 AND
>   replicate_on_write='true' AND
>   populate_io_cache_on_flush='false' AND
>   default_time_to_live=0 AND
>   speculative_retry='99.0PERCENTILE' AND
>   memtable_flush_period_in_ms=0 AND
>   compaction={'class': 'SizeTieredCompactionStrategy'} AND
>   compression={'sstable_compression': 'LZ4Compressor'};
>
> cqlsh:fiddle> select * from foo;
>
>  key   | fam  | qual | version | val
> -------+------+------+---------+--------
>  Clint | info | hair |       5 |  brown
>  Clint | info | hair |      10 | blonde
>
> (2 rows)
>
> cqlsh:fiddle> select val from foo where key='Clint' and fam='info' and
> qual='hair' and version <= 5;
>
>  val
> -------
>  brown
>
> (1 rows)
>
> cqlsh:fiddle> delete val from foo where key='Clint' and fam='info' and
> qual='hair' and version <= 5;
> Bad Request: Invalid operator LTE for PRIMARY KEY part version
>
>
> I assume the only way I can implement the functionality I'm looking
> for is to do a select, get a list of all of the elements that I want
> to delete, and then delete them in a big batch statement.  Is that
> correct?
>
> Thanks!
>
> Best regards,
> Clint
>

Mime
View raw message