Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-15169

SASI does not compare strings correctly

Agile BoardAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsVotersWatch issueWatchersCreate sub-taskConvert to sub-taskMoveLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      In our scenario, we need to query with '>' conditions on string columns. So I created index with  is_literal = false. like the following:

       

      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'};
      

       I also inserted some records and query:

       

      insert into test(id,t) values(1,'abc');
      select * from test where t > 'ab';
      

      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 

      Expression.isLowerSatisfiedBy

      function,

      term.compareTo

      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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mazhenlin mazhenlin Assign to me
            mazhenlin mazhenlin
            mazhenlin
            Michael Semb Wever
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment