maedhroz commented on code in PR #3095:
URL: https://github.com/apache/cassandra/pull/3095#discussion_r1589418915
##########
src/java/org/apache/cassandra/cql3/restrictions/StatementRestrictions.java:
##########
@@ -192,26 +189,27 @@ public StatementRestrictions(ClientState state,
*/
for (Relation relation : whereClause.relations)
{
- if ((relation.isContains() || relation.isContainsKey()) &&
(type.isUpdate() || type.isDelete()))
+
+ Operator operator = relation.operator();
+ if
(operator.requiresFilteringOrIndexingFor(ColumnMetadata.Kind.CLUSTERING) &&
(type.isUpdate() || type.isDelete()))
{
- throw invalidRequest("Cannot use %s with %s", type,
relation.operator());
+ throw invalidRequest("Cannot use %s with %s", type, operator);
}
- if (relation.operator() == Operator.IS_NOT)
+ if (operator == Operator.IS_NOT)
{
if (!forView)
throw new InvalidRequestException("Unsupported
restriction: " + relation);
- this.notNullColumns.addAll(relation.toRestriction(table,
boundNames).getColumnDefs());
+ this.notNullColumns.addAll(relation.toRestriction(table,
boundNames).columns());
}
- else if (relation.isLIKE())
+ else if (operator.requiresIndexing())
{
Restriction restriction = relation.toRestriction(table,
boundNames);
if (!type.allowUseOfSecondaryIndices() ||
!restriction.hasSupportingIndex(indexRegistry))
Review Comment:
nit: Could just use `indexRegistry.listIndexes()` and then IR doesn't have
to be `Iterable`. Also, what happens if `indexRegistry` is `null`?
--
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]