Details
-
Sub-task
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
None
-
Tested from build CASSANDRA-11067
Description
Tested from build CASSANDRA-11067
CREATE KEYSPACE music WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE music.albums ( id int PRIMARY KEY, artist text, title text, year int ); INSERT INTO music.albums(id, artist, title, year) VALUES (1, 'Bullets and Octane', 'In the Mouth of the Young', 2006); INSERT INTO music.albums(id, artist, title, year) VALUES (2, 'Quantic', 'Look Around The Corner', 2012); INSERT INTO music.albums(id, artist, title, year) VALUES (3, 'America', 'View From the Ground', 1982); CREATE CUSTOM INDEX ON music.albums (year) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'mode': 'SPARSE', 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer'}; SELECT artist,title,year FROM music.albums; artist | title | year -------------------+----------------------------+------ Bullets and Octane | In the Mouth of the Young | 2006 Quantic | Look Around the Corner | 2012 America | View From the Ground | 1982
The index was properly created. It can be found calling DESCRIBE TABLE albums; as well as in system_schema.indexes.
Strangely, the index does not return any data:
SELECT * FROM music.albums WHERE year=2006; (0 rows)
However range query using the index fails with a cryptic exception:
SELECT * FROM music.albums WHERE year>=1981 AND year<=1990 LIMIT 10; Traceback (most recent call last): File "/opt/apps/apache-cassandra-3.4/bin/cqlsh.py", line 1250, in perform_simple_statement result = future.result() File "/opt/apps/apache-cassandra-3.4/bin/../lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", line 3122, in result raise self._final_exception ReadFailure: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
The real exception message in /var/log/cassandra/system.log is:
Caused by: java.lang.IllegalArgumentException: null
at org.apache.cassandra.index.sasi.memory.SkipListMemIndex.search(SkipListMemIndex.java:75) ~[main/:na]
at org.apache.cassandra.index.sasi.memory.IndexMemtable.search(IndexMemtable.java:69) ~[main/:na]
at org.apache.cassandra.index.sasi.conf.ColumnIndex.searchMemtable(ColumnIndex.java:107) ~[main/:na]
at org.apache.cassandra.index.sasi.TermIterator.build(TermIterator.java:87) ~[main/:na]
at org.apache.cassandra.index.sasi.plan.QueryController.getIndexes(QueryController.java:146) ~[main/:na]
at org.apache.cassandra.index.sasi.plan.Operation$Builder.complete(Operation.java:423) ~[main/:na]
at org.apache.cassandra.index.sasi.plan.QueryPlan.analyze(QueryPlan.java:57) ~[main/:na]
at org.apache.cassandra.index.sasi.plan.QueryPlan.execute(QueryPlan.java:68) ~[main/:na]
at org.apache.cassandra.index.sasi.SASIIndex.lambda$searcherFor$241(SASIIndex.java:256) ~[main/:na]
at org.apache.cassandra.index.sasi.SASIIndex$$Lambda$248/1287847768.search(Unknown Source) ~[na:na]
at org.apache.cassandra.db.ReadCommand.executeLocally(ReadCommand.java:354) ~[main/:na]