cassandra SQL 查询未按 order by | 执行排序在 apache-cassandra SQL 中不起作用

问题描述 投票:0回答:1

我目前在 xyz 数据库中遇到查询问题。当我尝试执行查询时

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

我收到以下错误消息:

"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."

我尝试自行解决此问题,但未能找到解决方案。我非常感谢社区提供有关如何解决此问题的任何见解或建议。

apache cassandra datastax-enterprise cassandra-3.0
1个回答
0
投票

没有解决方法。它指出,如果不指定分区键,则无法使用 ALLOW FILTERING 和 ORDER BY。鉴于您的语句使用

x='data'
,我假设 x 不是分区键,因此您不能使用 ORDER BY。

© www.soinside.com 2019 - 2024. All rights reserved.