My table :
CREATE TABLE user_position (
geopart text, // first 3 characters of geohash
geohash text,
datetime timestamp,
userId bigint,
PRIMARY KEY ((geopart), geohash, datetime, user_id)
);
My dummy query :
select * from user_position where geopart = 'abc' and geohash > 'a' and geohash < 'z' and datetime >= '2015-08-08 15:08:58+0530';
Error:
Bad Request: PRIMARY KEY column "datetime" cannot be restricted (preceding column "geohash" is restricted by a non-EQ relation)
Question:
What I am doing wrong? If range on multiple columns is not possible in Cassandra then how can I achieve this?
Cassandra is quite restrictive when it comes to querying, in that it is not general purpose like a RDBMS. You cannot perform a range query on multiple columns in Cassandra. The following rules also apply:
All of these rules are there to avoid people running anti-patterns within Cassandra.
One option you have to perform a range query on multiple columns and to have a more robust method of retrieving your data is to integrate with a search platform such as Solr.
Este artigo é coletado da Internet.
Se houver alguma infração, entre em [email protected] Delete.
deixe-me dizer algumas palavras