maedhroz commented on code in PR #3645:
URL: https://github.com/apache/cassandra/pull/3645#discussion_r1836959125
##########
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:
Generally making the "why" in cases where AF is required more obvious could
be a follow-up for sure. (At the end of the day, there's a part of me that
would like to just get rid of AF as a thing, but yeah...I know it can still be
dangerous.)
@sunil9977 Let's at least fix the docs here, removing both `OR` and `IN`
form the supported operator list in
`doc/modules/cassandra/partials/sai/supported-query-operators-list.adoc`. This
is the doc you're referring to @ekaterinadimitrova2?
--
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]