首页 文章

Cassandra w / CQL3是否支持“WITH CLUSTERING ORDER”选项?

提问于
浏览
3

我正在使用带有CQL 3.0的Cassandra 1.1.0 .

创建表时,会发生以下错误 . 我提到http://www.datastax.com/dev/blog/cql3-evolutions

cqlsh:test> CREATE TABLE timeseries (
        ...   event_type text,
        ...   insertion_time timestamp,
        ...   event blob,
        ...   PRIMARY KEY (event_type, insertion_time)
        ... ) WITH CLUSTERING ORDER BY insertion_time DESC;
Bad Request: line 6:22 mismatched input 'ORDER' expecting '='

这是无效的查询吗?你有什么建议吗?

谢谢 .

2 回答

  • 8

    WITH CLUSTERING ORDER 语法仅在Cassandra 1.1.1中添加(几天前刚刚发布),因此它在1.1.0中不起作用 .

    但是,该示例缺少聚类定义周围的一些括号 . 你要:

    CREATE TABLE timeseries (
       event_type text,
       insertion_time timestamp,
       event blob,
       PRIMARY KEY (event_type, insertion_time)
    ) WITH CLUSTERING ORDER BY (insertion_time DESC);
    

    希望有所帮助 . 我会让那篇文章的作者知道这个问题 .

  • 0

相关问题