cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kelsey McKenna (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CASSANDRA-12785) LIKE query with partition key restriction gives unexpected results
Date Thu, 13 Oct 2016 15:51:20 GMT
Kelsey McKenna created CASSANDRA-12785:
------------------------------------------

             Summary: 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)

Mime
View raw message