I would like to execute a double-range query to get latitude and longitude points around one point,
in Kassandra now seems possible, I just tried
create column family users
with comparator=UTF8Type
AND key_validation_class=UTF8Type
and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
{column_name: type, validation_class: UTF8Type, index_type: KEYS},
{column_name: lat, validation_class: LongType, index_type: KEYS},
{column_name: lon, validation_class: LongType, index_type: KEYS}];
SET users['a']['type']='test';
SET users['b']['type']='test';
SET users['c']['type']='test';
SET users['a']['lat']='12';
SET users['b']['lat']='9';
SET users['c']['lat']='12';
SET users['b']['lon']='1';
SET users['a']['lon']='4';
SET users['c']['lon']='2';
get users where type = 'test' and lon < '6' and lon > '3' and lat > '10' and lat < '13';
RowKey: a => (column = lat, value = 12, timestamp = 1336339056413000) => (column = lon, value = 4, timestamp = 1336339088170000) => (column = type, value = test, timestamp = 1336339033765000)
1 Return a row.
But I'm really worried about performances when adding thousands of points if these 3 columns are indexed.
1) I had to use an indexed type column, because without it the query fails
No indexed columns present in index clause with operator EQ
Is it possible to get around it?
2). Naturally, it is natural to sort all the data using lat or lon, and then just request another,
, SliceQuery lat x y,
get users where type = 'test' and lon < '6' and lon > '3';
CF , (: String lat + lon UTF8-), ?