Skip to content

Instantly share code, notes, and snippets.

@babo
Last active August 29, 2015 14:01
Show Gist options
  • Save babo/3f215e3e745628d6a2ae to your computer and use it in GitHub Desktop.
Save babo/3f215e3e745628d6a2ae to your computer and use it in GitHub Desktop.
Cassandra-4476
CREATE KEYSPACE c4476 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
USE c4476;
CREATE TABLE users (
userid uuid,
age int,
firstname text,
lastname text,
PRIMARY KEY (userid)
);
CREATE INDEX users_age ON users (age);
CREATE INDEX users_first ON users (firstname);
CREATE INDEX users_last ON users (lastname);
INSERT INTO users (userid, firstname, lastname , age ) VALUES ( 01234567-0123-0123-0123-0123456789ab, 'John', 'Doo', 24);
select * from users WHERE age=24;
select * from users WHERE age<30;
diff --git i/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java w/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
index 6b4309f..df17a3e 100644
--- i/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
+++ w/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java
@@ -1311,7 +1311,7 @@ public class SelectStatement implements CQLStatement, MeasurableForPreparedCache
ColumnDefinition def = cfDef.cfm.getColumnDefinition(name.name.key);
stmt.restrictedNames.add(name);
- if (def.isIndexed() && rel.operator() == Relation.Type.EQ)
+ if (def.isIndexed()) // && rel.operator() == Relation.Type.EQ)
{
hasQueriableIndex = true;
if (name.kind == CFDefinition.Name.Kind.COLUMN_ALIAS)
diff --git i/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java w/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
index e93efd1..7ac7e02 100644
--- i/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
+++ w/src/java/org/apache/cassandra/db/index/SecondaryIndexSearcher.java
@@ -63,7 +63,7 @@ public abstract class SecondaryIndexSearcher
continue;
SecondaryIndex index = indexManager.getIndexForColumn(expression.column_name);
- if (index == null || index.getIndexCfs() == null || expression.op != IndexOperator.EQ)
+ if (index == null || index.getIndexCfs() == null) // || expression.op != IndexOperator.EQ)
continue;
int columns = index.getIndexCfs().getMeanColumns();
candidates.put(index, columns);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment