Hi Abhishek, Sorry for the slow response.
I would assume the main reason is simply that nobody has implemented the functionality. However, there might be some ideological opposition as well. This query is impossible to implement as efficiently on the server as it is on the client. It shouldn’t be too tricky to implement. If you’re interested in doing so, perhaps others can chime in with their views on its acceptability. I personally don’t see an issue with it, though it would be nice if we could submit warnings back with query responses that the query is inefficient - but that’s a separate feature request. In an ideal world, we would support an approach where a token-aware client could take a list parameter, then group the list by token and submit separate queries to the server. It might be that we would need to provide extra information to the client on preparing such a query. This might be a burden on clients, but would offer an efficient option without loss of ergonomics to the user, while also supporting the inefficient option where the client driver does not currently support the feature. Note, none of this would probably qualify for any community investment on review or integration until 4.0 is released. > On 22 Mar 2019, at 18:21, Abhishek Maloo <abhima...@gmail.com> wrote: > > Hello All, > I am trying to migrate some thrift "multiget(multiple partitions)" > operations to CQL. > My Schema is - > CREATE TABLE table1 (key1 int, key2 int, col1 int, val int,* primary > key((key1, key2), col1)*) > It has a *compound partition key* - (k1,k2) > > While converting the multiget I came up with this query - > *select * from table1 where (k1, k2) IN ((1,1), (2,2));* > > Cassandra threw an exception - *"InvalidRequest: Error from server: > code=2200 [Invalid query] message="Multi-column relations can only be > applied to clustering columns but was applied to: key1"* > > What is the rationale behind not supporting Multi-column relation for > partition keys only. I understand that we want to discourage the use of > multiget. > > Apparently below are valid cassandra queries - > *select * from table1 where k1 IN (1,2) and k2 = 1;* > *select * from table1 where k1 = 1 and k2 IN (1,2);* > > Thanks > -Abhishek --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@cassandra.apache.org For additional commands, e-mail: dev-h...@cassandra.apache.org