Re: Map return for multiget_slice() query

2010-01-13 Thread Joe Stump
I ran into this problem in Python because dict's aren't ordered in Python. Not 
sure if that applies here.

--Joe

On Jan 12, 2010, at 2:22 AM, Richard Grossman wrote:

 Hi
 
 I've a simple CF like this : 
  ColumnFamily CompareWith=BytesType 
   Name=channelShow
   FlushPeriodInMinutes=150/
 
 When I make a query via multiget_slice() I expect to get the  data back 
 ordered by the keys list that I pass. But not the return doesn't follow any 
 order even not the natural key order.
 
 Example I call like this : 
 COLUM_PARENT_CHANNEL_SHOW = new ColumnParent(channelShow, null);
 PREDICATE_CHANNEL_SHOW = new SlicePredicate(null, new SliceRange(new byte[0], 
 new byte[0], false, 30));
 client.multiget_slice(Keyspace1, keys, COLUM_PARENT_CHANNEL_SHOW, 
 PREDICATE_CHANNEL_SHOW, ConsistencyLevel.QUORUM);  
 
 So How to make this if the keys = {5, 8, 12, 1 ,3, 21} how to get the result 
 in this order ?
 
 Thanks
 
 Richard



Re: Map return for multiget_slice() query

2010-01-12 Thread Jonathan Ellis
You'll have to sort them client-side, thrift has no concept of an
order-preserving map and multiget is just a series of gets
conveniently combined with no ordering guarantees (unlike
get_range_slice which returns a List specifically to preserve order).

-Jonathan

On Tue, Jan 12, 2010 at 3:22 AM, Richard Grossman richie...@gmail.com wrote:
 Hi

 I've a simple CF like this :
  ColumnFamily CompareWith=BytesType
                   Name=channelShow
                   FlushPeriodInMinutes=150/

 When I make a query via multiget_slice() I expect to get the  data back
 ordered by the keys list that I pass. But not the return doesn't follow any
 order even not the natural key order.

 Example I call like this :
 COLUM_PARENT_CHANNEL_SHOW = new ColumnParent(channelShow, null);
 PREDICATE_CHANNEL_SHOW = new SlicePredicate(null, new SliceRange(new
 byte[0], new byte[0], false, 30));
 client.multiget_slice(Keyspace1, keys, COLUM_PARENT_CHANNEL_SHOW,
 PREDICATE_CHANNEL_SHOW, ConsistencyLevel.QUORUM);

 So How to make this if the keys = {5, 8, 12, 1 ,3, 21} how to get the result
 in this order ?

 Thanks

 Richard