You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "mazhenlin (Jira)" <ji...@apache.org> on 2019/10/16 16:47:00 UTC

[jira] [Commented] (CASSANDRA-15169) SASI does not compare strings correctly

    [ https://issues.apache.org/jira/browse/CASSANDRA-15169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952989#comment-16952989 ] 

mazhenlin commented on CASSANDRA-15169:
---------------------------------------

The failed tests are unrelated. 
{quote} if you look through the docs at [https://github.com/apache/cassandra/blob/trunk/doc/SASI.md] you see a few different use-cases.
{quote}
I am not sure what you mean. I have run the demo queries in the doc and found these queries do not work as  described:
{code:java}
SELECT * FROM sasi WHERE bio LIKE 'they argued';
SELECT * FROM sasi WHERE bio LIKE 'working at the company';
SELECT * FROM sasi WHERE bio LIKE 'soft eng';
{code}
All of them return 0 rows. The same happens at trunk. Maybe we can fix it in a new ticket.

> SASI does not compare strings correctly
> ---------------------------------------
>
>                 Key: CASSANDRA-15169
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15169
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Feature/SASI
>            Reporter: mazhenlin
>            Assignee: mazhenlin
>            Priority: Normal
>         Attachments: CASSANDRA-15169-v1.patch, CASSANDRA-15169-v2.patch
>
>
> In our scenario, we need to query with '>' conditions on string columns. So I created index with  is_literal = false. like the following:
>  
> {code:java}
> CREATE TABLE test (id int primary key, t text);
> CREATE CUSTOM INDEX ON test (t) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'is_literal': 'false'};
> {code}
>  I also inserted some records and query:
>  
> {code:java}
> insert into test(id,t) values(1,'abc');
> select * from test where t > 'ab';
> {code}
> At first ,it worked. But after flush, the query returned none record.
> I have read the code of SASIIndex and found that it is because in the 
> {code:java}
> Expression.isLowerSatisfiedBy{code}
> function,
> {code:java}
> term.compareTo{code}
> was called with parameter checkFully=false, which cause the string 'abc' was only compared with its first 2 characters( length of expression value).
>  
> I have wrote a UT for this case and fixed it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org