使用CQL从Cassandra Column中选择First N.

时间:2011-11-10 16:43:41

标签: cassandra cql

如何在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客户端

帮助 此致,泰米尔语

1 个答案:

答案 0 :(得分:4)

找到解决方案,

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

这有效

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