cassandra SQL Query is not executing with order by | Sorting is not working in apache-cassandra SQL

33 views Asked by At

I am currently experiencing an issue with a query in my xyz database. When I try to execute the query

select * from table where x='data' order by created_at desc ALLOW FILTERING,

I am receiving the following error message:

"InvalidRequest: Error from server: code=2200 [Invalid query] message="ORDER BY is only supported when the partition key is restricted by an EQ or an IN."

I have tried troubleshooting this issue on my own, but have not been able to find a solution. I would greatly appreciate any insights or suggestions from the community on how to resolve this problem.

1

There are 1 answers

0
stevenlacerda On

There isn't a workaround. It states that you can't use ALLOW FILTERING and ORDER BY without specifying a partition key. Given that your statement uses x='data', I'm assuming that x is not the partition key and thus you can't use ORDER BY.