[ https://issues.apache.org/jira/browse/CASSANDRA-18217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716806#comment-17716806 ]
Andres de la Peña commented on CASSANDRA-18217: ----------------------------------------------- Here is a patch removing the need of using {{ALLOW FILTERING}} when all the filtering expressions are supported by a single index group: ||PR||CI|| |[16052|https://github.com/maedhroz/cassandra/pull/11]|[j8|https://app.circleci.com/pipelines/github/adelapena/cassandra/2872/workflows/6b028cb0-214d-49a3-867a-cb9485155f09] [j11|https://app.circleci.com/pipelines/github/adelapena/cassandra/2872/workflows/1d9f147c-e387-43ea-80a9-2a493f0cb655]| The approach consists on delegating most of the {{ALLOW FILTERING}} checks to a series of {{needsFiltering}} methods on the restrictions, so they can find out if is an index group able to process them. Additionally to the number of queried columns, I have found that there is also a requirement to use AF when there query has multiple contains expressions, even if they are for the same column. For example: {code:java} CREATE TABLE %s (pk int primary key, value map<int, text>); CREATE CUSTOM INDEX ON %s(ENTRIES(value)) USING 'StorageAttachedIndex'; SELECT * FROM %s WHERE value[1] = 'v1' AND value[2] = 'v2' ALLOW FILTERING; {code} I think that makes sense for legacy indexes, where we can only efficiently query a single value. However, SAI doesn't seem to perform filtering in that case, so IUC it shouldn't require {{{}ALLOW FILTERING{}}}. So I have added a new {{Index#filtersMultipleContains}} method to define whether the index implementation is able to process multiple contains without filtering. I have also eliminated all the now unneeded uses of {{ALLOW FILTERING}} that I have found on the tests. In order to reduce the risk of missing something, I have extended {{IndexQuerySupport.BaseQuerySet#validate}} to verify that any query supplied with AF really needs it. > Allow CQL queries on multiple indexes without ALLOW FILTERING > ------------------------------------------------------------- > > Key: CASSANDRA-18217 > URL: https://issues.apache.org/jira/browse/CASSANDRA-18217 > Project: Cassandra > Issue Type: Improvement > Components: Feature/SAI > Reporter: Mike Adamson > Assignee: Andres de la Peña > Priority: Normal > Labels: SAI > > The Index Group index was added by > [CASSANDRA-16092|https://issues.apache.org/jira/browse/CASSANDRA-16092] to > allow indexes to be grouped and have more than one index expression in a > query. This did not make any changes to StatementRestrictions so CQL queries > using multiple index expression still need to add ALLOW FILTERING to the > query to be valid. > This restriction should be removed such that any number of index expressions > can be used on a CQL query without needing ALLOW FILTERING. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org