adelapena commented on code in PR #2673:
URL: https://github.com/apache/cassandra/pull/2673#discussion_r1333310626
##########
src/java/org/apache/cassandra/cql3/statements/SelectStatement.java:
##########
@@ -535,7 +538,7 @@ public ResultMessage.Rows executeInternal(QueryState state,
try (ReadExecutionController executionController =
query.executionController())
{
- if (aggregationSpec == null && (pageSize <= 0 ||
(query.limits().count() <= pageSize)))
+ if (aggregationSpec == null && (pageSize <= 0 ||
(query.limits().count() <= pageSize) || query.isTopK()))
Review Comment:
It seems that using ANN on an aggregation query will start paging (that we
don't support). The query will be rejected by SAI validation as requiring a
page limit, even if it actually has one:
```java
@Test
public void testAggregation()
{
createTable("CREATE TABLE %s (k int PRIMARY KEY, v vector<float, 1>, c
int)");
createIndex("CREATE CUSTOM INDEX ON %s(v) USING 'StorageAttachedIndex'
WITH OPTIONS = {'similarity_function' : 'euclidean'}");
execute("INSERT INTO %s (k, v, c) VALUES (1, [4], 1)");
execute("INSERT INTO %s (k, v, c) VALUES (2, [3], 10)");
execute("INSERT INTO %s (k, v, c) VALUES (3, [2], 100)");
execute("INSERT INTO %s (k, v, c) VALUES (4, [1], 1000)");
assertRows(execute("SELECT sum(c) FROM %s"), row(1111));
assertRows(execute("SELECT sum(c), v FROM %s"), row(1111, vector(4f)));
assertRows(execute("SELECT sum(c) FROM %s WHERE k = 1 ORDER BY v ANN OF
[0] LIMIT 4"), row(1111, vector(1f))); // rejected!
}
```
Should we forbid aggregation queries with ANN?
--
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]