当使用where子句时,Cassandra astyanax sql查询错误输出

时间:2014-05-08 05:16:58

标签: java cassandra astyanax

选择where子句在cassandra cqlsh>中正常工作但不是来自Astyanax。但是,没有where子句的SLQ子句可以从astyanax中正常工作。不确定我有什么想法?

CREATE TABLE personalization1 (
                       username text primary key,
                      incidentPage text,
                      timelinePage text,
                      );

insert into personalization1 (username,incidentpage,timelinepage) values ('3cd70b90-d211-11e3-8774-14109fdb7013','3cd70b90-d211-11e3-8774-14109fdb7013','3cd70b90-d211-11e3-8774-14109fdb7013');

SELECT * FROM personalization1 where username='3cd70b90-d211-11e3-8774-14109fdb7013' ;

com.netflix.astyanax.connectionpool.exceptions.BadRequestException:BadRequestException:[host = 10.65.240.89(10.65.240.89):9160,latency = 237(342),attempts = 1] InvalidRequestException(why:not indexed columns present in-columns子句,带“equals”运算符)     在com.netflix.astyanax.thrift.ThriftConverter.ToConnectionPoolException(ThriftConverter.java:159)     在com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:65)     在com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:28)     at com.netflix.astyanax.thrift.ThriftSyncConnectionFactoryImpl $ ThriftConnection.execute(ThriftSyncConnectionFactoryImpl.java:151)     at com.netflix.astyanax.connectionpool.impl.AbstractExecuteWithFailoverImpl.tryOperation(AbstractExecuteWithFailoverImpl.java:119)     at com.netflix.astyanax.connectionpool.impl.AbstractHostPartitionConnectionPool.executeWithFailover(AbstractHostPartitionConnectionPool.java:338)     在com.netflix.astyanax.thrift.AbstractThriftCqlQuery.execute(AbstractThriftCqlQuery.java:41)     在com.ebay.timeline.dao.PersonaliztionDAOTest.test(PersonaliztionDAOTest.java:83)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at java.lang.reflect.Method.invoke(Unknown Source)     在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:47)     在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)     在org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)     在org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)     在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)     在org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)     在org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)     在org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)     在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)     在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)     在org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:238)     在org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:63)     在org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)     在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:53)     在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:229)     在org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)     在org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)     在org.junit.runners.ParentRunner.run(ParentRunner.java:309)     在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)     在org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)     在org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)     在org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 引起:InvalidRequestException(原因:带有“equals”运算符的by-columns子句中没有索引列)     在org.apache.cassandra.thrift.Cassandra $ execute_cql_query_result.read(Cassandra.java:36625)     在org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)     在org.apache.cassandra.thrift.Cassandra $ Client.recv_execute_cql_query(Cassandra.java:1525)     在org.apache.cassandra.thrift.Cassandra $ Client.execute_cql_query(Cassandra.java:1511)     在com.netflix.astyanax.thrift.ThriftCqlQuery.execute_cql_query(ThriftCqlQuery.java:33)     在com.netflix.astyanax.thrift.AbstractThriftCqlQuery $ 1.internalExecute(AbstractThriftCqlQuery.java:46)     在com.netflix.astyanax.thrift.AbstractThriftCqlQuery $ 1.internalExecute(AbstractThriftCqlQuery.java:43)     在com.netflix.astyanax.thrift.AbstractOperationImpl.execute(AbstractOperationImpl.java:60)

1 个答案:

答案 0 :(得分:0)

我从堆栈跟踪中注意到正在使用“execute_cql_query”函数,而不是“execute_cql3_query”,因此正在运行的查询正在运行,就像它在cqlsh -2中执行一样,这很可能就是问题。来自cql2的事物视图的主键名称可能是“关键”。