小编Yur*_*yad的帖子

Cassandra如何按时间戳排序

我有桌子 -

CREATE TABLE IF NOT EXISTS Chat(
  id UUID,
  time timestamp,
  idSender UUID,
  message varchar,
  PRIMARY KEY ((id),time))
WITH CLUSTERING ORDER BY(time DESC);
Run Code Online (Sandbox Code Playgroud)

我想按时间对我的消息进行排序。但是当我运行时,Cassandra 不会对我的表进行排序:

select * from chat order by time
Run Code Online (Sandbox Code Playgroud)

它显示消息

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.
Run Code Online (Sandbox Code Playgroud)

如何按时间对表格进行排序?

sorting cql cassandra cassandra-2.0 cassandra-3.0

2
推荐指数
1
解决办法
4614
查看次数

标签 统计

cassandra ×1

cassandra-2.0 ×1

cassandra-3.0 ×1

cql ×1

sorting ×1