【问题标题】:Select First N from Cassandra Column using CQL使用 CQL 从 Cassandra 列中选择 First N
【发布时间】:2011-12-26 08:30:28
【问题描述】:

如何在 Cassandra 中获取给定行键的前 N ​​列?

cqlsh> select FIRST 5 from Daily_Domain_Stats where KEY = '20111110:1';
Bad Request: line 1:15 no viable alternative at input 'from'
cqlsh> select 'FIRST' 5 from Daily_Domain_Stats where KEY = '20111110:1';
Bad Request: line 1:15 no viable alternative at input '5'
cqlsh> select 'FIRST 5' from Daily_Domain_Stats where KEY = '20111110:1';
cqlsh> select FIRST '5' from Daily_Domain_Stats where KEY = '20111110:1';
Internal application error
cqlsh> select 5 from Daily_Domain_Stats where KEY = '20111110:1';
cqlsh> select [FIRST 5] from Daily_Domain_Stats where KEY = '20111110:1';
Bad Request: line 1:15 no viable alternative at character ']'

我尝试了所有这些方法,但都没有给我正确的结果。我正在使用 cql 1.0.5 Python 客户端

帮助 问候,泰米尔语

【问题讨论】:

    标签: cassandra cql


    【解决方案1】:

    找到解决办法,

    cqlsh> select first 5 '0'..'9' from Daily_Customer_Stats;
    

    成功了

    参考http://www.slideshare.net/jericevans/cql20

    【讨论】:

    • 为什么?我不明白 '0'..'9' 代表什么,我继续收到您在上面指定的错误。
    • 我希望 cassandra 是 0.8.0 时回答了这个问题。你能查看最新的文档吗?
    • 显然 CQL 3 不再支持此功能:stackoverflow.com/a/30571744/89590
    猜你喜欢
    • 2013-09-13
    • 2014-11-27
    • 1970-01-01
    • 2012-06-17
    • 2023-03-10
    • 2016-04-14
    • 2014-03-23
    • 1970-01-01
    • 2018-02-21
    相关资源
    最近更新 更多