Thanks. it helps.

2011/8/17 Boris Yen <yulin...@gmail.com>

> Each compositeType consistes of a few components. Use ("bob", 1982) as an
> example, it contains two components, I assume it is (utf8, integer). So when
> you want to use a slice query, you need the start and end columns by add
> components to them. That is what start.addCompo.... and end.addCompo...
> means. For more information please refer to
> https://issues.apache.org/jira/browse/CASSANDRA-2231
>
> For you question, I think replace "abc" with "bob" should do the trick.
>
> On Wed, Aug 17, 2011 at 4:56 AM, Alvin UW <alvi...@gmail.com> wrote:
>
>> Hello,
>>
>> can anyone give an explanation of
>> start.addComponent("abc", StringSerializer.get()) ;
>> end.addComponent("abc", StringSerializer.get(), "UTF8Type",
>> AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL) ;
>>
>>
>> Suppose my composite column names are like ("bob", 1982),  ("bob", 1976).
>> There are more than one "bob" in my table.
>> now I only know I want to query "bob", but don't know the birth year, how
>> can I get all the column values of "Bob"? with the help of composite type.
>>
>>
>>
>>
>> 2011/8/4 Boris Yen <yulin...@gmail.com>
>>
>>> 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 <
>>> cassandralear...@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 <yulin...@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 <elda...@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!
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to