My understanding is you expected to see 

111:ticks
222:ticks
333:ticks
444:ticks

But instead you are getting 

111:ticks
111:quote
222:ticks
222:quote
333:ticks
333:quote
444:ticks

If that is the case things are working as expected. 

The slice operation gets a column range. So if you start at 111:ticks and end 
at 444:ticks you are asking for all the column in between. 

it is not possible to filter at each level of a composite column. 

Hope that helps.
 
-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com

On 10/02/2012, at 10:58 PM, Deno Vichas wrote:

> all,
> 
> could somebody clue me to why the below code doesn't work.  my schema is;
> 
> create column family StockHistory
>     with comparator = 'CompositeType(LongType,UTF8Type)'
>     and default_validation_class = 'UTF8Type'
>     and key_validation_class = 'UTF8Type';
> 
> 
>  the time part works but i'm getting other column with the second half not 
> equaling the value set.  it's like it's ignoring the string part of the 
> composite.
> 
>         Composite start = new Composite();
>         Composite end = new Composite();
>         start.addComponent(0, 
> startDate.toDateTimeAtStartOfDay().toDate().getTime(), 
> Composite.ComponentEquality.EQUAL);
>         end.addComponent(0, endDate.toDateMidnight().toDate().getTime(), 
> Composite.ComponentEquality.EQUAL);
> 
>         start.addComponent(1, "ticks", Composite.ComponentEquality.EQUAL);
>         end.addComponent(1, "ticks", 
> Composite.ComponentEquality.GREATER_THAN_EQUAL);
> 
>         SliceQuery<String, Composite, String> sliceQuery =
>                 HFactory.createSliceQuery(_keyspace, _stringSerializer, new 
> CompositeSerializer(), _stringSerializer);
>         sliceQuery.setColumnFamily(CF_STOCK_HISTORY).setKey(symbol);
>         sliceQuery.setRange(start, end, false, 10);
> 
>         QueryResult<ColumnSlice<Composite, String>> result = 
> sliceQuery.execute();
>         ColumnSlice<Composite, String> cs = result.get();
>         SortedSet<String> historyJSON = new TreeSet<String>();
>         for ( HColumn<Composite, String> col: cs.getColumns() ) {
>             System.out.println(col.getName().get(0, _longSerializer) +"|"+ 
> col.getName().get(1,StringSerializer.get()));
>         }
> 
> 
> this outputs the following;
> 
>     1327035600000|ticks
>     1327046400000|quote
>     1327294800000|ticks
>     1327305600000|quote
>     1327381200000|ticks
>     1327392000000|quote
>     1327467600000|ticks
>     1327478400000|quote
>     1327554000000|ticks
>     1327564800000|quote
> 
> thanks,
> deno

Reply via email to