【发布时间】:2026-01-11 01:00:02
【问题描述】:
我正在尝试获取 cassandra DB 中表的计数,我正在运行以下查询:
select count(*)
from bssapi.call_detail_records
WHERE
year = 2020
and month = 3
and event_at > '2020-03-01 07:45:51+0000' ALLOW FILTERING;
我得到的错误是:
InvalidRequest: code=2200 [Invalid query] message="Partitioning column "year" cannot be restricted because the preceding column ("ColumnDefinition{name=subscription_id, type=org.apache.cassandra.db.marshal.UTF8Type, kind=PARTITION_KEY, componentIndex=0, indexName=null, indexType=null}") is either not restricted or is restricted by a non-EQ relation"
当我通过添加订阅 ID 过滤查询时,系统会正确返回计数,仅当我对所有表运行计数时才会出现此问题。
【问题讨论】:
-
你能分享你的这个表的架构吗?