【问题标题】:CQL : InvalidRequest: Error from server: code=2200 [Invalid query]CQL:InvalidRequest:来自服务器的错误:code=2200 [无效查询]
【发布时间】:2019-11-05 22:16:06
【问题描述】:
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:来自服务器的错误:code=2200 [无效查询]
message="last_modified_date 列缺少 CLUSTERING ORDER"

【问题讨论】:

    标签: cassandra


    【解决方案1】:
    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 排序,它必须是集群键的一部分。

    【讨论】:

      猜你喜欢
      • 2023-03-08
      • 1970-01-01
      • 2015-06-12
      • 2016-09-16
      • 1970-01-01
      • 2023-03-17
      • 2021-12-15
      • 1970-01-01
      • 2017-12-30
      相关资源
      最近更新 更多