Hi fellow developers, I am a bit stuck in a request in cassandra, I am trying to do Google how to add a restriction / setting in cassandra, and got some example, so I create such a method, I use Hector for the client API:
IndexedSlicesQuery<String,String,String> indexedSlicesQuery=new IndexedSlicesQuery<String, String, String>(keyspace, serializer, serializer, serializers);
indexedSlicesQuery.addEqualsExpression(columnName, value);
indexedSlicesQuery.setReturnKeysOnly();
indexedSlicesQuery.setColumnFamily(COLUMNFAMILY);
indexedSlicesQuery.setStartKey("");
QueryResult<OrderedRows<String,String,String>> result=indexedSlicesQuery.execute();
return result;
Is this a method? is the "WHERE" method equal to indexedSlicesQuery.addEqualsExpression(columnName, value);?
can any body help me? I'm still trying to do this because I have some error:
1296 [main] INFO me.prettyprint.cassandra.hector.TimingLogger - start[1306744089788] time[158] tag[READ.fail_]
Exception in thread "main" me.prettyprint.hector.api.exceptions.HInvalidRequestException: InvalidRequestException(why:No indexed columns present in index clause with operator EQ)
at me.prettyprint.cassandra.service.ExceptionsTranslatorImpl.translate(ExceptionsTranslatorImpl.java:42)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl$12.execute(KeyspaceServiceImpl.java:513)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl$12.execute(KeyspaceServiceImpl.java:495)
at me.prettyprint.cassandra.service.Operation.executeAndSetResult(Operation.java:101)
at me.prettyprint.cassandra.connection.HConnectionManager.operateWithFailover(HConnectionManager.java:221)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl.operateWithFailover(KeyspaceServiceImpl.java:129)
at me.prettyprint.cassandra.service.KeyspaceServiceImpl.getIndexedSlices(KeyspaceServiceImpl.java:517)
at me.prettyprint.cassandra.model.IndexedSlicesQuery$1.doInKeyspace(IndexedSlicesQuery.java:140)
at me.prettyprint.cassandra.model.IndexedSlicesQuery$1.doInKeyspace(IndexedSlicesQuery.java:131)
at me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:20)
at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspace.java:85)
at me.prettyprint.cassandra.model.IndexedSlicesQuery.execute(IndexedSlicesQuery.java:130)
iam sorry for my question about newbie and my bad english..thanks ..: D
UPDATE
OK, after Google and Google search, I found solutions based on this Link , this technique is to create index_type when creating some sort of column family like this (based on this link):
[default@demo] create column family users with comparator=UTF8Type
... and column_metadata=[{column_name: full_name, validation_class: UTF8Type},
... {column_name: state, validation_class: UTF8Type},
... {column_name: birth_date, validation_class: LongType, index_type: KEYS}];
, lid ordinray sql cassandra-cli.. hector..thanks ..: D