如何在cassandra中使用group by、order by和like子句?

rlcwz9us  于 2021-06-13  发布在  Cassandra
关注(0)|答案(0)|浏览(339)

我使用Cassandra有以下方案:

CREATE ColumnFamily vgsales
(
rank int,
name varchar,
platform varchar,
year int,
genre varchar,
publisher varchar,
na_sales float,
eu_sales float,
jp_sales float,
other_sales float,
global_sales float,
PRIMARY KEY (rank, platform, publisher, genre)
)
WITH CLUSTERING ORDER BY (platform ASC);

问题是我在运行一些查询时遇到了一些问题。
对于以下查询:

1) select platform, count(platform) as quantity from vgsales group by platform order by quantity desc;
2) select genre, sum(na_sales) as sumNA_sales, sum(eu_sales) as sumEU_sales, sum(jp_sales) as sumJP_sales, sum(other_sales) as sumOther_sales from vgsales group by genre;
3) select publisher, sum(global_sales) as totalsales from vgsales group by publisher order by totalsales desc;

我有同样的无效请求:
invalidrequest:error from server:code=2200[invalid query]message=“分组依据当前仅支持按主键中声明顺序排列的列组”
对于此查询:

4) select * from vgsales where name like 'Grand Theft Auto%' order by year asc;

我有以下无效请求:
invalidrequest:来自服务器的错误:code=2200[invalid query]message=“like限制仅在索引正确的列上受支持。像“grand theft auto%”这样的名称无效。“
我怎样才能绕过这个问题,让它们正常运行?
提前谢谢!

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题