开发人员您好,我在运行上面的代码时遇到错误:
public void getConditioningQuery(String columnName,String value){
QueryResult<OrderedRows<String, String, String>> result =
(QueryResult<OrderedRows<String, String, String>>) new IndexedSlicesQuery<String, String, String>(keyspace, serializer, serializer, serializer)
.addEqualsExpression("state", "TI")
.setReturnKeysOnly()
.setColumnFamily(CF_NAME)
.setStartKey("")
.execute();
System.out.println("Result="+result.get().getList());
}
此方法是查找 state=TI 的行。我已经在列族中添加了索引,如果我在 cassandra-cli 中手动查询,则会显示数据,但如果我使用使用 hector 的代码,我会收到此错误:
在我的 IDE=
345 [main] INFO me.prettyprint.cassandra.service.JmxMonitor - Registering JMX me.prettyprint.cassandra.service_MyCluster:ServiceType=hector,MonitorType=hector
867 [main] INFO me.prettyprint.cassandra.hector.TimingLogger - start[1306754734185] time[91] tag[WRITE.success_]
10926 [main] INFO me.prettyprint.cassandra.hector.TimingLogger - start[1306754734314] time[10021] tag[READ.fail_]
me.prettyprint.hector.api.exceptions.HTimedOutException: TimedOutException()
at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:32)
并在 cassandra 日志中=
ERROR 18:25:34,326 Fatal exception in thread Thread[ReadStage:102,5,main]
java.lang.AssertionError: No data found for NamesQueryFilter(columns=) in DecoratedKey(165611378069681836494944905825187619237, 73616e6a6f7578):QueryPath(columnFamilyName='user', superColumnName='null', columnName='null') (original filter NamesQueryFilter(columns=)) from expression 'user.state EQ TI'
at org.apache.cassandra.db.ColumnFamilyStore.scan(ColumnFamilyStore.java:1603)
at org.apache.cassandra.service.IndexScanVerbHandler.doVerb(IndexScanVerbHandler.java:42)
at org.apache.cassandra.net.MessageDeliveryTask.run(MessageDeliveryTask.java:72)
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)
我很困惑,因为错误是告诉是否找不到列族用户中的列中的数据,但是如果我使用 cassandra-cli,则显示数据..
我很困惑,仍然卡在这里..也许我的方法是错误的?有人可以帮我告诉我出了什么问题吗?我仍然谷歌来解决这个问题..感谢您的关注,对不起我的英语不好:D..