Hi! Partition key (Id in your case) must be in WHERE cause if not using indexes (but indexes should be used carefully, not like in case of relational DB's). Also, only columns which belong to primary key ( = partition key + clustering key) can be used in WHERE in such cases. That's why 2nd and 3rd are failing. You might find this useful: http://cassandra.apache.org/doc/latest/cql/dml.html#the-where-clause
There are several Cassandra handbooks available on Amazon, maybe it would be helpful for you to use some of them as starting point to understand aspects of Cassandra data[query] modeling. Regards, Kyrill ________________________________ From: Behroz Sikander <behro...@gmail.com> Sent: Thursday, March 1, 2018 2:36:28 PM To: user@cassandra.apache.org Subject: Cassandra filter with ordering query modeling Hi,own vote favorite<https://stackoverflow.com/questions/49049760/cassandra-filter-with-ordering-query-modeling#> I am new to Cassandra and I am trying to model a table in Cassandra. My queries look like the following Query #1: select * from TableA where Id = "123" Query #2: select * from TableA where name="test" orderby startTime DESC Query #3: select * from TableA where state="running" orderby startTime DESC I have been able to build the table for Query #1 which looks like val tableAStatement = SchemaBuilder.createTable("tableA").ifNotExists. addPartitionKey(Id, DataType.uuid). addColumn(Name, DataType.text). addColumn(StartTime, DataType.timestamp). addColumn(EndTime, DataType.timestamp). addColumn(State, DataType.text) session.execute(tableAStatement) but for Query#2 and 3, I have tried many different things but failed. Everytime, I get stuck in a different error from cassandra. Considering the above queries, what would be the right table model? What is the right way to model such queries. Regards, Behroz