[ https://issues.apache.org/jira/browse/CASSANDRA-17198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17492515#comment-17492515 ]
Benjamin Lerer edited comment on CASSANDRA-17198 at 2/15/22, 10:34 AM: ----------------------------------------------------------------------- [~subkanthi] Looking at the patch there are several point that would need to be changed. * Without indexes LIKE restrictions can only be performed through filtering. That means that the queries should fail if {{ALLOW FILTERING}} is not specified. As shown by some of the unit tests it is not the case. This should be changed for clustering columns by modifying {{StatementRestrictions.processClusteringColumnRestrictions}} and for the partition keys by modifying {{PartitionKeySingleRestrictionSet.needFiltering}}. For that last one you will need to add a new {{hasLike}} method to {{Restrictions}} and use it. * If the user attempt to use a LIKE restriction on a column which is not a string type the error can be confusing. The logic within {{SingleColumnRelation.newLikeRestriction}} can be changed to validate that the type of the receiver (for a LIKE you are guaranty to have only one) is a instanceof StringType. * It should be good to test that LIKE statement cannot be used on UPDATE or DELETE statements. was (Author: blerer): [~subkanthi] Looking at the patch there are several point that would need to be changed. * Without indexes LIKE restrictions can only be performed through filtering. That means that the queries should fail if {{ALLOW FILTERING}} is not specified. As shown by some of the unit tests it is not the case. This should be changed for clustering columns by modifying {{StatementRestrictions.processClusteringColumnRestrictions}} and for the partition keys by modifying {{PartitionKeySingleRestrictionSet.needFiltering}}. For that last one you will need to add a new {{hasLike}} method to {{Restrictions}} and use it. * If the user attempt to use a LIKE restriction on a column which is not a string type the error can be confusing. The logic within {{SingleColumnRelation.newLikeRestriction}} can be changed to validate that the type of the receiver (for a LIKE you are guaranty to have only one) is a instanceof StringType. > Allow to filter using LIKE predicates > ------------------------------------- > > Key: CASSANDRA-17198 > URL: https://issues.apache.org/jira/browse/CASSANDRA-17198 > Project: Cassandra > Issue Type: Improvement > Components: CQL/Syntax > Reporter: Benjamin Lerer > Assignee: Kanthi Subramanian > Priority: Normal > Labels: AdventCalendar2021, lhf > Fix For: 4.x > > > {{LIKE}} predicates can only be used with the SASI indices. In several > usecases (e.g. querying the {{settings}} virtual table) it makes sense to > support them for filtering. > +Additional information for newcomers:+ > There are some checks in the {{StatementRestrictions}} constructor and on > {{LikeRestriction}} that need to be removed for allowing filtering using LIKE > on clustering and regular columns. > For filtering on partition columns the {{needFiltering}} methods in > {{PartitionKeySingleRestrictionSet}} will need to be modified to return true > when LIKE predicate are used. > The unit tests should go in {{SelectTest}}. -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org