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

[jira] [Comment Edited] (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=16952124#comment-16952124 ] 

Michael Semb Wever edited comment on CASSANDRA-15169 at 10/16/19 8:21 AM:
--------------------------------------------------------------------------

[~mazhenlin], if you look through the docs at https://github.com/apache/cassandra/blob/trunk/doc/SASI.md you see a few different use-cases.

I've updated the unit tests to go through more of these use-cases.

bq. there are many restrictions in the code for not applying RANGE on literal indexes(e.g. ColumnIndex.supports)…

thanks for pointing that out. agreed, using "ALLOW FILTERING" isn't exactly testing the index, but the at least it's testing that the index doesn't do that query and the results that will be returned otherwise. nonetheless, i've updated the tests (my branches listed above) to verify when the index will work (and won't).


||branch||circleci||asf jenkins testall||asf jenkins dtests||
|[mck/cassandra-3.11_15169|https://github.com/apache/cassandra/compare/trunk...thelastpickle:mck/cassandra-3.11_15169]|[circleci|https://circleci.com/gh/thelastpickle/workflows/cassandra/tree/mck%2Fcassandra-3.11_15169]|[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/57//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/57/]|[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/692//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/692]|
|[mck/trunk_15169|https://github.com/apache/cassandra/compare/trunk...thelastpickle:mck/trunk_15169]|[circleci|https://circleci.com/gh/thelastpickle/workflows/cassandra/tree/mck%2Ftrunk_15169]|[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/58//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-testall/58/]|[!https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/693//badge/icon!|https://builds.apache.org/view/A-D/view/Cassandra/job/Cassandra-devbranch-dtest/693]|




was (Author: michaelsembwever):
[~mazhenlin], if you look through the docs at https://github.com/apache/cassandra/blob/trunk/doc/SASI.md you see a few different use-cases.

I've updated the unit tests to go through more of these use-cases.

bq. there are many restrictions in the code for not applying RANGE on literal indexes(e.g. ColumnIndex.supports)…

thanks for pointing that out. agreed, using "ALLOW FILTERING" isn't exactly testing the index, but the at least it's testing that the index doesn't do that query and the results that will be returned otherwise. nonetheless, i've updated the tests (my branches listed above) to verify when the index will work (and won't).

> 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