Aaron,

For writing, i am using cli.
Below is the piece of code that is reading column names of different types.


Composite start = new Composite();

                start.addComponent(0, beginTime,
                                Composite.ComponentEquality.EQUAL);
                
                if (columns != null){
                        int colCount =1;
                        for (String colName : columns){
                                
start.addComponent(colCount,colName,Composite.ComponentEquality.EQUAL);
                                colCount++;
                        }
                }

                Composite finish = new Composite();
                finish.addComponent(0, endTime,
                                Composite.ComponentEquality.EQUAL);
                
                if (columns != null){
                        int colCount =1;
                        for (String colName : columns){
                                if (colCount == columns.size())
                                        finish.addComponent(colCount,colName+ 
Character.MAX_VALUE,
Composite.ComponentEquality.GREATER_THAN_EQUAL);
                                //Greater_than_equal is meant for any subslices 
to A:B:C if searched on A:B
                                else
                                        
finish.addComponent(colCount,colName,Composite.ComponentEquality.EQUAL);
                                colCount++;
                        }
                }
                SliceQuery<String, Composite, String> sq
              =  HFactory.createSliceQuery(keyspace, StringSerializer.get(),
                                           new CompositeSerializer(),
                                           StringSerializer.get());
                sq.setColumnFamily(columnFamilyName);

                sq.setKey(key);
                logger.debug("Start:"+start+",finish:"+finish);
                sq.setRange(start, finish, false, 10000);

                QueryResult<ColumnSlice<Composite, String>> result = sq
                                .execute();
                ColumnSlice<Composite, String> orderedRows = result.get();

Please let me know if you additional info.

Thanks,
Sunit.

On Fri, Jul 6, 2012 at 10:59 AM, aaron morton <aa...@thelastpickle.com> wrote:
> Can you provide an example of writing and reading column names of a
> different type.
>
> Thanks
>
> -----------------
> Aaron Morton
> Freelance Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 6/07/2012, at 11:30 AM, Sunit Randhawa wrote:
>
> HI Aaron,
>
> It is
>
> create column family CF
>            with comparator =
> 'CompositeType(org.apache.cassandra.db.marshal.Int32Type,org.apache.cassandra.db.marshal.UTF8Type,org.apache.cassandra.db.marshal.UTF8Type)'
>    and key_validation_class = UTF8Type
>    and default_validation_class = UTF8Type;
>
> This is allowing me to insert column names of different type.
>
> Thanks,
> Sunit.
> On Thu, Jul 5, 2012 at 4:24 PM, aaron morton <aa...@thelastpickle.com>
> wrote:
>
> #2 has the Composite Column and #1 does not.
>
>
> They are both strings.
>
>
> All column names *must* be of the same type. What was your CF definition ?
>
>
> Cheers
>
>
> -----------------
>
> Aaron Morton
>
> Freelance Developer
>
> @aaronmorton
>
> http://www.thelastpickle.com
>
>
> On 6/07/2012, at 7:26 AM, Sunit Randhawa wrote:
>
>
> Hello,
>
>
> I have 2 Columns for a 'RowKey' as below:
>
>
> #1 : set CF['RowKey']['1000']='A=1,B=2';
>
> #2: set CF['RowKey']['1000:C1']='A=2,B=3'';
>
>
> #2 has the Composite Column and #1 does not.
>
>
> Now when I execute the Composite Slice query by 1000 and C1, I do get
>
> both the columns above.
>
>
> I am hoping get #2 only since I am specifically providing "C1" as
>
> Start and Finish Composite Range with
>
> Composite.ComponentEquality.EQUAL.
>
>
>
> I am not sure if this is by design.
>
>
> Thanks,
>
> Sunit.
>
>
>
>

Reply via email to