Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8AA04200B84 for ; Tue, 20 Sep 2016 17:45:23 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 87469160AC0; Tue, 20 Sep 2016 15:45:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C2FF2160AC5 for ; Tue, 20 Sep 2016 17:45:22 +0200 (CEST) Received: (qmail 35033 invoked by uid 500); 20 Sep 2016 15:45:21 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 35012 invoked by uid 99); 20 Sep 2016 15:45:21 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Sep 2016 15:45:21 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 73CFF2C2A65 for ; Tue, 20 Sep 2016 15:45:21 +0000 (UTC) Date: Tue, 20 Sep 2016 15:45:21 +0000 (UTC) From: "DOAN DuyHai (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CASSANDRA-12573) SASI index. Incorrect results for '%foo%bar%'-like search pattern. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 20 Sep 2016 15:45:23 -0000 [ https://issues.apache.org/jira/browse/CASSANDRA-12573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15506923#comment-15506923 ] DOAN DuyHai commented on CASSANDRA-12573: ----------------------------------------- [~mkrupits] I've reproduced the issue and found the root cause. For the sake of clarity, I have created another JIRA [CASSANDRA-12674] explaining the issue in details. Can you please close this one ? > SASI index. Incorrect results for '%foo%bar%'-like search pattern. > ------------------------------------------------------------------- > > Key: CASSANDRA-12573 > URL: https://issues.apache.org/jira/browse/CASSANDRA-12573 > Project: Cassandra > Issue Type: Bug > Reporter: Mikhail Krupitskiy > Priority: Critical > Labels: sasi > > We use Cassandra 3.7 and have faced a strange behaviour of SELECT requests with "LIKE '%foo%bar%'" constraints on a column with SASI index. > Below are few experiments that show this behaviour. > Experiment 1: > {noformat} > drop keyspace if exists kmv; > create keyspace if not exists kmv WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor':'1'} ; > use kmv; > CREATE TABLE if not exists kmv (id int primary key, c1 text, c2 text); > CREATE CUSTOM INDEX ON kmv.kmv ( c2 ) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { > 'mode': 'CONTAINS' > }; > insert into kmv (id, c1, c2) values (1, 'f21', 'qwe') ; > insert into kmv (id, c1, c2) values (2, 'f22', 'qweasd') ; > insert into kmv (id, c1, c2) values (3, 'f23', 'qwea1') ; > insert into kmv (id, c1, c2) values (4, 'f24', '1qwe') ; > insert into kmv (id, c1, c2) values (5, 'f25', 'asdqwe') ; > select c2 from kmv.kmv where c2 like '%w%a%'; > {noformat} > Expected result: qweasd, qwea1. > Actual result: no rows. > Experiment 2 (NOTE: definition of index is changed): > {noformat} > drop keyspace if exists kmv; > create keyspace if not exists kmv WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor':'1'} ; > use kmv; > CREATE TABLE if not exists kmv (id int primary key, c1 text, c2 text); > CREATE CUSTOM INDEX ON kmv.kmv ( c2 ) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { > 'mode': 'CONTAINS', > 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', > 'analyzed': 'true' > }; > insert into kmv (id, c1, c2) values (1, 'f21', 'qwe') ; > insert into kmv (id, c1, c2) values (2, 'f22', 'qweasd') ; > insert into kmv (id, c1, c2) values (3, 'f23', 'qwea1') ; > insert into kmv (id, c1, c2) values (4, 'f24', '1qwe') ; > insert into kmv (id, c1, c2) values (5, 'f25', 'asdqwe') ; > select c2 from kmv.kmv where c2 like '%w%a%'; > {noformat} > Expected result: qweasd, qwea1. > Actual result: asdqwe, qweasd, qwea1. > Experiment 3 (NOTE: primary key is compound now and inserted data was changed): > {noformat} > drop keyspace if exists kmv; > create keyspace if not exists kmv WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor':'1'} ; > use kmv; > CREATE TABLE if not exists kmv (id int, c1 text, c2 text, PRIMARY KEY(id, c1)); > CREATE CUSTOM INDEX ON kmv.kmv ( c2 ) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { > 'mode': 'CONTAINS', > 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', > 'analyzed': 'true' > }; > insert into kmv (id, c1, c2) values (1, 'f21', 'qwe') ; > insert into kmv (id, c1, c2) values (1, 'f22', 'qweasd') ; > insert into kmv (id, c1, c2) values (1, 'f23', 'qwea1') ; > insert into kmv (id, c1, c2) values (1, 'f24', '1qwe') ; > insert into kmv (id, c1, c2) values (1, 'f25', 'asdqwe') ; > select c2 from kmv.kmv where c2 like '%w%a%'; > {noformat} > Expected result: qweasd, qwea1. > Actual result: qwe, qweasd, qwea1, 1qwe, asdqwe. > Experiment 4 (NOTE: search criteria is changed): > {noformat} > drop keyspace if exists kmv; > create keyspace if not exists kmv WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor':'1'} ; > use kmv; > CREATE TABLE if not exists kmv (id int, c1 text, c2 text, PRIMARY KEY(id, c1)); > CREATE CUSTOM INDEX ON kmv.kmv ( c2 ) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { > 'mode': 'CONTAINS', > 'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', > 'analyzed': 'true' > }; > insert into kmv (id, c1, c2) values (1, 'f21', 'qwe') ; > insert into kmv (id, c1, c2) values (1, 'f22', 'qweasd') ; > insert into kmv (id, c1, c2) values (1, 'f23', 'qwea1') ; > insert into kmv (id, c1, c2) values (1, 'f24', '1qwe') ; > insert into kmv (id, c1, c2) values (1, 'f25', 'asdqwe') ; > select c2 from kmv.kmv where c2 like '%w22%a%'; > {noformat} > Expected result: no rows. > Actual result: qweasd, qwea1, asdqwe. -- This message was sent by Atlassian JIRA (v6.3.4#6332)