How to make a sub-task in cassandra db

I am trying to restore the last state of my object, but this subblock selection is not working, I saw that the new version of cassandra db supports aggregated operations and subqueries.

select * from event_store 
   where event_version = (select max(event_version) from event_store) 
    ALLOW FILTERING;

      

SyntaxException: line 1:49 no viable alternative when entering "select" (... from event_store where event_version = [(] select ...)

+3


source to share


1 answer


You can do this using 2 separate requests:

select max(event_version) from event_store;

      

and then

select * from event_store where event_version = 2 allow filtering;

      

Maybe I'm a little outdated, but it looks like there is no support for sub-selection:



Work on this ticket has been discontinued

https://issues.apache.org/jira/browse/CASSANDRA-8846

There have been attempts to do this:

https://github.com/jobmthomas/Cassandra-SubQuery

But in general this is not supported in cassandra.

+2


source







All Articles