CQL:InvalidRequest:来自服务器的错误:代码= 2200 [无效查询]

时间:2019-06-24 06:29:55

标签: cassandra

create table cd_ml_api.sf_leads (
    id timeuuid,
    email text ,
    cdh_org text,
    source_of_funds text ,
    currency_purpose text ,
    created_date timestamp,
    last_modified_date timestamp,
    PRIMARY KEY (email, last_modified_date)
)  WITH CLUSTERING ORDER BY (id DESC);

在cassandra终端中显示错误:

  

InvalidRequest:来自服务器的错误:代码= 2200 [无效查询]   
message =“列last_modified_date的缺少排序顺序”

1 个答案:

答案 0 :(得分:0)

create table cd_ml_api.sf_leads (
    id timeuuid,
    email text ,
    cdh_org text,
    source_of_funds text ,
    currency_purpose text ,
    created_date timestamp,
    last_modified_date timestamp,
    PRIMARY KEY (email, last_modified_date)
)  WITH CLUSTERING ORDER BY (last_modified_date DESC);

Cassandra只能按聚类键排序。 为了按ID排序,它必须是聚簇键的一部分。

相关问题