incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Boris Yen <yulin...@gmail.com>
Subject Re: HOW TO select a column or all columns that start with X
Date Thu, 04 Aug 2011 09:10:31 GMT
Assume you have a column family named "testCF" with comparator *
CompositeType*(AsciiType, IntegerType(reversed=true), IntegerType); and a
few columns have been inserted into record key "a".

____________________________________
Composite start = new Composite() ;
Composite end = new Composite() ;
start.addComponent("abc", StringSerializer.get()) ;
end.addComponent("abc", StringSerializer.get(), "UTF8Type",
AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL) ;

SliceQuery<String, ByteBuffer, ByteBuffer> query =
HFactory.createSliceQuery(keyspace, StringSerializer.get(),
ByteBufferSerializer.get(), ByteBufferSerializer.get());
query.setKey("a");
query.setColumnFamily("testCF");
query.setRange(start.serialize(), end.serialize(), false, 100);

List<HColumn<ByteBuffer, ByteBuffer>> columns =
query.execute().get().getColumns();


On Thu, Aug 4, 2011 at 3:19 PM, CASSANDRA learner <
cassandralearner@gmail.com> wrote:

> Can you please gimme an example on this using hector client
>
>
> On Thu, Aug 4, 2011 at 7:18 AM, Boris Yen <yulinyen@gmail.com> wrote:
>
>> It seems to me that your column name consists of two components. If you
>> have the luxury to upgrade your cassandra to 0.8.1+, I think you can think
>> about using the composite type/column. Conceptually, it might suit your use
>> case better.
>>
>>
>> On Wed, Aug 3, 2011 at 5:28 AM, Eldad Yamin <eldad87@gmail.com> wrote:
>>
>>> Hello,
>>> I wonder if I can select a column or all columns that start with X.
>>> E.g I have columns ABC_1, ABC_2, ZZZ_1 and I want to select all columns
>>> that start with ABC_ - is that possible?
>>>
>>>
>>>
>>> Thanks!
>>>
>>
>>
>

Mime
View raw message