That this will get you *worse* performance than just doing a seq scan would.
Details as to why this is, are here: http://www.datastax.com/dev/blog/whats-new-cassandra-07-secondary-indexes On Tue, Jun 19, 2012 at 2:48 PM, Yuhan Zhang <[email protected]> wrote: > To anwser my own question: > > There should be at least on "equal" expression in the indexed query to > combine with a "gte". > so, I just added an trivial column that stays constant for equal comparison. > and it works. > > not sure why this requirement exists. > > Thank you. > > Yuhan > > > On Tue, Jun 19, 2012 at 12:23 PM, Yuhan Zhang <[email protected]> wrote: >> >> Hi all, >> >> I'm trying to search by the secondary index of cassandra with "greater >> than or equal". but reached an exception stating: >> me.prettyprint.hector.api.exceptions.HInvalidRequestException: >> InvalidRequestException(why:No indexed columns present in index clause with >> operator EQ) >> >> However, the same column family with the same column, work when the search >> expression is an "equal". I'm using the Hector java client. >> The secondary index type has been set to: {column_name: sport, >> validation_class: DoubleType, index_type:KEYS } >> >> here's the code reaching the exception: >> >> public QueryResult<OrderedRows<String, String, Double>> >> getIndexedSlicesGTE(String columnFamily, String columnName, double value, >> String... columns) { >> Keyspace keyspace = getKeyspace(); >> StringSerializer se = CassandraStorage.getStringExtractor(); >> >> IndexedSlicesQuery<String, String, Double> indexedSlicesQuery = >> createIndexedSlicesQuery(keyspace, se, se, DoubleSerializer.get()); >> indexedSlicesQuery.setColumnFamily(columnFamily); >> indexedSlicesQuery.setStartKey(""); >> if(columns != null) >> indexedSlicesQuery.setColumnNames(columns); >> else { >> indexedSlicesQuery.setRange("", "", true, MAX_RECORD_NUMBER); >> } >> >> indexedSlicesQuery.setRowCount(CassandraStorage.MAX_RECORD_NUMBER); >> indexedSlicesQuery.addGteExpression(columnName, value); >> // this doesn't work :( >> //indexedSlicesQuery.addEqualsExpression(columnName, value); // >> this works! >> QueryResult<OrderedRows<String, String, Double>> result = >> indexedSlicesQuery.execute(); >> >> return result; >> } >> >> >> Is there any column_meta setting that is required in order to make GTE >> comparison works on secondary index? >> >> Thank you. >> >> Yuhan Zhang >> >> >> > > > > -- > Yuhan Zhang > Application Developer > OneScreen Inc. > [email protected] > www.onescreen.com > > The information contained in this e-mail is for the exclusive use of the > intended recipient(s) and may be confidential, proprietary, and/or legally > privileged. Inadvertent disclosure of this message does not constitute a > waiver of any privilege. If you receive this message in error, please do > not directly or indirectly print, copy, retransmit, disseminate, or > otherwise use the information. In addition, please delete this e-mail and > all copies and notify the sender. -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of DataStax, the source for professional Cassandra support http://www.datastax.com
