maedhroz commented on code in PR #4290:
URL: https://github.com/apache/cassandra/pull/4290#discussion_r2334906276
##########
test/unit/org/apache/cassandra/index/sai/cql/AllowFilteringTest.java:
##########
@@ -433,4 +433,83 @@ public void testAllowFilteringDuringIndexBuild() throws
Throwable
execute("SELECT * FROM %s WHERE v=0");
execute("SELECT * FROM %s WHERE v=0 ALLOW FILTERING");
}
+
+ @Test
+ public void testAllowFilteringWithLikePrefixPostFiltering()
+ {
+ createTable("CREATE TABLE %S (k1 int, k2 text, k3 int, PRIMARY KEY
(k1))");
+ createIndex("CREATE INDEX ON %s(k3) USING 'sai'");
+
+ execute("insert into %s (k1, k2, k3) values (1, 'fo', 1)");
+ execute("insert into %s (k1, k2, k3) values (2, 'foo', 2)");
+ execute("insert into %s (k1, k2, k3) values (3, 'fo', 3)");
+ execute("insert into %s (k1, k2, k3) values (4, 'ba', 4)");
+ execute("insert into %s (k1, k2, k3) values (5, 'bar', 5)");
+
+ assertRowCount(execute("SELECT * FROM %s WHERE k3 > 0 AND k2 LIKE
'f%%' ALLOW FILTERING"), 3);
+ assertRowCount(execute("SELECT * FROM %s WHERE k3 > 0 AND k2 LIKE
'ca%%' ALLOW FILTERING"), 0);
+ assertThatThrownBy(() -> execute("SELECT * FROM %s WHERE k3 > 0 AND k2
LIKE 'f%%'"))
+ .hasMessageContaining("use ALLOW FILTERING")
Review Comment:
nit: Can we use `StatementRestrictions.REQUIRES_ALLOW_FILTERING_MESSAGE`?
--
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]