【发布时间】:2015-01-30 19:21:57
【问题描述】:
在 cqlsh 中执行以下查询时出现错误
查询
SELECT * FROM ragchews.disc_location WHERE country_code = 12 AND lat > 100.00 and lat < 120.00 and lng > 50 and lng < 100 allow filtering;
表格
CREATE TABLE ragchews.disc_location (
country_code int,
lat float,
lng float,
uid text,
PRIMARY KEY (country_code, lat, lng, uid)
);
错误:
code=2200 [Invalid query] message="PRIMARY KEY column "lng" cannot be restricted (preceding column "ColumnDefinition{name=lat, type=org.apache.cassandra.db.marshal.FloatType, kind=CLUSTERING_COLUMN, componentIndex=0, indexName=null, indexType=null}" is either not restricted or by a non-EQ relation)"
Cassandra 版本
[cqlsh 5.0.1 | Cassandra 2.1.2 | CQL spec 3.2.0 | Native protocol v3]
编辑 1
以下查询对我来说很好用
SELECT * FROM ragchews.disc_location WHERE country_code=91 and lat > 32 and lat < 100 allow filtering;
lng 列似乎有问题。
【问题讨论】: