[ https://issues.apache.org/jira/browse/CASSANDRA-12785?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sam Tunnicliffe resolved CASSANDRA-12785. ----------------------------------------- Resolution: Duplicate Looks like this is probably a duplicate of CASSANDRA-12746, > LIKE query with partition key restriction gives unexpected results > ------------------------------------------------------------------ > > Key: CASSANDRA-12785 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12785 > Project: Cassandra > Issue Type: Bug > Components: sasi > Reporter: Kelsey McKenna > Priority: Minor > > When trying to query a table using the LIKE keyword and a partial restriction > of the partition key, unexpected results are given. > Either the query is returning the wrong data, or the query shouldn't be > allowed since the partition key is being partially restricted. Please see the > demonstration below: > {code} > DROP TABLE IF EXISTS example; > > CREATE TABLE example ( > indextype text, > indexref text, > phrase text, > PRIMARY KEY ((indextype, indexref), phrase) > ); > > CREATE CUSTOM INDEX example_contains ON example(phrase) USING > 'org.apache.cassandra.index.sasi.SASIIndex' > WITH OPTIONS = { 'mode': 'CONTAINS' }; > > INSERT INTO example(indextype, indexref, phrase) VALUES('A', 'a1', 'potato'); > INSERT INTO example(indextype, indexref, phrase) VALUES('A', 'a2', 'rubato'); > INSERT INTO example(indextype, indexref, phrase) VALUES('B', 'a3', 'tomato'); > > SELECT * FROM example > WHERE indextype='A' > AND phrase LIKE '%ato%' > allow filtering; > {code} > The expected output is > {code} > | indextype | indexref | phrase | > | A | a2 | rubato | > | A | a1 | potato | > {code} > The actual output is > {code} > | indextype | indexref | phrase | > | B | a3 | tomato | > | A | a2 | rubato | > | A | a1 | potato | > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)