ekaterinadimitrova2 commented on code in PR #3645:
URL: https://github.com/apache/cassandra/pull/3645#discussion_r1835871454
##########
test/unit/org/apache/cassandra/index/sai/cql/AllowFilteringTest.java:
##########
@@ -296,6 +296,91 @@ public void
testAllowFilteringOnClusteringAndRegularColumns() throws Throwable
test("SELECT * FROM %s WHERE v1=0 AND v2=0 AND k1=0 AND k2=0 AND (c1,
c2, c3, c4) = (0, 0, 0, 0) AND v3=0", true);
}
+ @Test
+ public void testAllowFilteringTextWithINClause ()
+ {
+ createTable("CREATE TABLE %S (k1 TEXT, k2 TEXT, k3 TEXT, PRIMARY
KEY(k1))");
+ createIndex("CREATE INDEX ON %s(K2) USING 'sai'");
+
+ execute("INSERT INTO %s (k1,k2,k3) VALUES ('s1','s11','s111')");
+ execute("INSERT INTO %s (k1,k2,k3) VALUES ('s2','s11','s11')");
+ execute("INSERT INTO %s (k1,k2,k3) VALUES ('s3','s22','s111')");
+ execute("INSERT INTO %s (k1,k2,k3) VALUES ('s4','s22','s111')");
+ execute("INSERT INTO %s (k1,k2,k3) VALUES ('s5','s31','s111')");
+
+ assertRowCount(execute("SELECT * FROM %s WHERE k2='s11' AND k3 IN
('s11','s111') ALLOW FILTERING"),2);
+ assertRowCount(execute("SELECT * FROM %s WHERE k2='s22' AND k3 IN
('s111','s111') ALLOW FILTERING"), 2);
+ assertRowCount(execute("SELECT * FROM %s WHERE k2='s22' AND k3 IN
('s','s1') ALLOW FILTERING"), 0);
+ // To test if an IN clause without an AND condition does not create a
query plan and works as expected.
+ assertRowCount(execute("SELECT * FROM %s WHERE k2 IN ('s11','s22')
ALLOW FILTERING"), 4);
Review Comment:
I noticed that we return if we remove the ALLOW FILTERING:
` Cannot execute this query as it might involve data filtering and thus may
have unpredictable performance. If you want to execute this query despite the
performance unpredictability, use ALLOW FILTERING`
Shouldn't we improve the error to explain that IN is not supported with SAI
indexes?
I find this confusing for an end user. In addition to the docs that say that
SAI supports it when it doesn't :(
Maybe in a follow up ticket or so?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]