Soheil Rahsaz created CASSANDRA-19924:
-----------------------------------------
Summary: SASI mixed with `IN` condition returns invalid result,
Cassandra 5.0.0GA
Key: CASSANDRA-19924
URL: https://issues.apache.org/jira/browse/CASSANDRA-19924
Project: Cassandra
Issue Type: Bug
Reporter: Soheil Rahsaz
Given this sample table
{code:java}
CREATE TABLE usersbyorganization
(
organizationid UUID,
userid UUID,
displayname TEXT,
rolecode TEXT,
PRIMARY KEY (organizationid, userid)
) WITH CLUSTERING ORDER BY (userid ASC);
CREATE CUSTOM INDEX usersbyorganization_displayname_idx ON usersbyorganization
(displayname)
USING 'org.apache.cassandra.index.sasi.SASIIndex'
WITH OPTIONS = {'analyzed': 'true', 'analyzer_class':
'org.apache.cassandra.index.sasi.analyzer.NonTokenizingAnalyzer',
'case_sensitive': 'false', 'mode': 'CONTAINS'};
{code}
and sample data
{code:java}
INSERT INTO usersbyorganization (organizationid, userid, displayname, rolecode)
VALUES (0326bd0a-f977-408f-b5fa-52902eb1fd0f,
233569aa-1d3d-4bac-a73a-5f382a7bf144, 'soheil', 'admin');
INSERT INTO usersbyorganization (organizationid, userid, displayname, rolecode)
VALUES (0326bd0a-f977-408f-b5fa-52902eb1fd0f,
811804f2-6ede-487d-9b2c-c9f487ff77d9, 'soheil', 'staff');
INSERT INTO usersbyorganization (organizationid, userid, displayname, rolecode)
VALUES (0326bd0a-f977-408f-b5fa-52902eb1fd0f,
104f8cbc-e22e-4629-b836-2f832e59c4a3, 'soheil', 'student');
INSERT INTO usersbyorganization (organizationid, userid, displayname, rolecode)
VALUES (0326bd0a-f977-408f-b5fa-52902eb1fd0f,
b4b405df-0da6-4a99-b46a-4419a505e96f, 'soheil', 'teacher');
{code}
If I run this query with only 1 value in the `IN clause`, it returns
appropriate result:
{code:java}
SELECT *
FROM usersbyorganization
WHERE organizationid = 0326bd0a-f977-408f-b5fa-52902eb1fd0f
AND displayname = 'soheil'
AND roleCode IN ('student')
ALLOW FILTERING;
{code}
|| organizationid || userid || displayname || rolecode ||
| 0326bd0a-f977-408f-b5fa-52902eb1fd0f | 104f8cbc-e22e-4629-b836-2f832e59c4a3 |
soheil | student |
But if I run the same query with 2 values in the `IN clause`, it returns
invalid values for column `roleCode`:
{code:java}
SELECT *
FROM usersbyorganization
WHERE organizationid = 0326bd0a-f977-408f-b5fa-52902eb1fd0f
AND displayname = 'soheil'
AND roleCode IN ('student', 'teacher')
ALLOW FILTERING;
{code}
|| organizationid || userid || displayname || rolecode ||
| 0326bd0a-f977-408f-b5fa-52902eb1fd0f | 104f8cbc-e22e-4629-b836-2f832e59c4a3 |
soheil | student |
| 0326bd0a-f977-408f-b5fa-52902eb1fd0f | 233569aa-1d3d-4bac-a73a-5f382a7bf144 |
soheil | admin |
| 0326bd0a-f977-408f-b5fa-52902eb1fd0f | 811804f2-6ede-487d-9b2c-c9f487ff77d9 |
soheil | staff |
| 0326bd0a-f977-408f-b5fa-52902eb1fd0f | b4b405df-0da6-4a99-b46a-4419a505e96f |
soheil | teacher |
`admin` and `staff` should not be returned.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]