我有一张使用 CQL3
创建的表,其中包括:
create table compositetest(m_id ascii,i_id int,l_id ascii,body ascii,
PRIMARY KEY(m_id,i_id,l_id));
插入了一些随机数据:
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m1',1,'l1','b1');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m2',2,'l2','b2');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m1',2,'l2','b2');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m2',1,'l1','b1');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m3',3,'l1','b1');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m3',2,'l2','b2');
cqlsh:testkeyspace1> insert into compositetest(m_id,i_id,l_id,body) VALUES ('m3',1,'l2','b2');
cqlsh:testkeyspace1> select * from compositetest;
m_id | i_id | l_id | body
------+------+------+------
m1 | 1 | l1 | b1
m1 | 2 | l2 | b2
m2 | 1 | l1 | b1
m2 | 2 | l2 | b2
m3 | 1 | l2 | b2
m3 | 2 | l2 | b2
m3 | 3 | l1 | b1
当我执行查询时
cqlsh:testkeyspace1> select * from compositetest where i_id<=3 limit 3;
m_id | i_id | l_id | body
------+------+------+------
m1 | 1 | l1 | b1
m1 | 2 | l2 | b2
m2 | 1 | l1 | b1
现在,如果我想获取接下来的3行。
cqlsh:testkeyspace1> ?
我试图编写用于切片范围的CQL(不确定是否可行)
我的CQLSh显示套接字已关闭,并且我看到了错误。
TSocket read 0 bytes
在服务器端,我看到以下错误:
ERROR [Thrift:3] 2012-08-12 15:15:24,414 CustomTThreadPoolServer.java (line 204) Error occurred during processing of message.
java.lang.NullPointerException
at org.apache.cassandra.cql3.statements.SelectStatement$Restriction.setBound(SelectStatement.java:1277)
at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.updateRestriction(SelectStatement.java:1151)
at org.apache.cassandra.cql3.statements.SelectStatement$RawStatement.prepare(SelectStatement.java:1001)
at org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:215)
at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:121)
at org.apache.cassandra.thrift.CassandraServer.execute_cql_query(CassandraServer.java:1237)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:3542)
at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql_query.getResult(Cassandra.java:3530)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:186)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
如何获取接下来的3行数据?关于服务器端异常问题,我会提交一个bug报告。CQLSh已关闭,我现在必须退出并重新连接。
i_id=1 and (...) i_id <= 3
"?你想通过分页获取的实际查询是什么? - the paul