[ 
https://issues.apache.org/jira/browse/CASSANDRA-21715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mauricio Audirac-Martínez updated CASSANDRA-21715:
--------------------------------------------------
    Description: 
CASSANDRA-18112 added the ability to include/exclude specific named indexes via 
WITH included_indexes=\{...} and WITH excluded_indexes=\{...}.

A common use case is wanting to exclude *all* applicable indexes from a query — 
to force ALLOW FILTERING behaviour, or to test what a query does without any 
index involvement — but currently this requires enumerating every index by 
name, which is inconvenient and brittle (the list silently becomes incomplete 
if a new index is added to the table).

 

This patch adds support for the * wildcard in excluded_indexes:

 

  SELECT * FROM t WHERE v = 0 ALLOW FILTERING

  WITH excluded_indexes = \{*};

 

The wildcard is resolved by the coordinator at validation time 
(IndexHints.fromCQLNames) into the full concrete set of indexes currently 
registered for the table, before the ReadCommand is sent to replicas. No 
messaging version bump is required.

 

Design decisions:
 - * is only valid in excluded_indexes. Using it in included_indexes throws 
InvalidRequestException (WILDCARD_INCLUDED_INDEXES_ERROR), since "include all 
indexes" has no defined semantics.

 - * can be combined with explicit names in the same set (e.g. \{*, idx1}), 
which is redundant but not an error.

 - A wildcard exclusion that conflicts with an included index (e.g. 
included_indexes=\{idx1} AND excluded_indexes=\{*}) fails with the same 
CONFLICTING_INDEXES_ERROR as an explicit conflict, since expansion happens 
before the conflict check.

 

Changes:
 - Parser.g: add indexNameOrWildcard rule; use indexNamesOrWildcards

  for excluded_indexes property.
 - QualifiedName: add WILDCARD sentinel and isWildcard().

 - IndexHints: add WILDCARD_INCLUDED_INDEXES_ERROR; expand wildcard in

  fetchIndexes(); update fromCQLNames javadoc.
 - IndexHints.md: document the wildcard syntax and semantics.

 - cql3handling.py: add <identifiersOrStars> for cqlsh autocomplete.

 - Tests: IndexHintsTest (unit), IndexHintsDistributedTest (distributed).

  was:
CASSANDRA-18112 added the ability to include/exclude specific named 

indexes via WITH included_indexes=\{...} and WITH excluded_indexes=\{...}.

 

A common use case is wanting to exclude *all* applicable indexes from a 

query — to force ALLOW FILTERING behaviour, or to test what a query 

does without any index involvement — but currently this requires 

enumerating every index by name, which is inconvenient and brittle (the 

list silently becomes incomplete if a new index is added to the table).

 

This patch adds support for the * wildcard in excluded_indexes:

 

  SELECT * FROM t WHERE v = 0 ALLOW FILTERING

  WITH excluded_indexes = \{*};

 

The wildcard is resolved by the coordinator at validation time 

(IndexHints.fromCQLNames) into the full concrete set of indexes 

currently registered for the table, before the ReadCommand is sent to 

replicas. No messaging version bump is required.

 

Design decisions:

- * is only valid in excluded_indexes. Using it in included_indexes 

  throws InvalidRequestException (WILDCARD_INCLUDED_INDEXES_ERROR), 

  since "include all indexes" has no defined semantics.

- * can be combined with explicit names in the same set 

  (e.g. \{*, idx1}), which is redundant but not an error.

- A wildcard exclusion that conflicts with an included index 

  (e.g. included_indexes=\{idx1} AND excluded_indexes=\{*}) fails with 

  the same CONFLICTING_INDEXES_ERROR as an explicit conflict, since 

  expansion happens before the conflict check.

 

Changes:

- Parser.g: add indexNameOrWildcard rule; use indexNamesOrWildcards 

  for excluded_indexes property.

- QualifiedName: add WILDCARD sentinel and isWildcard().

- IndexHints: add WILDCARD_INCLUDED_INDEXES_ERROR; expand wildcard in 

  fetchIndexes(); update fromCQLNames javadoc.

- IndexHints.md: document the wildcard syntax and semantics.

- cql3handling.py: add <identifiersOrStars> for cqlsh autocomplete.

- Tests: IndexHintsTest (unit), IndexHintsDistributedTest (distributed).


> Add * wildcard in excluded index hints
> --------------------------------------
>
>                 Key: CASSANDRA-21715
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21715
>             Project: Apache Cassandra
>          Issue Type: New Feature
>          Components: CQL/Syntax, Feature/SAI, Legacy/CQL
>            Reporter: Mauricio Audirac-Martínez
>            Assignee: Mauricio Audirac-Martínez
>            Priority: Normal
>
> CASSANDRA-18112 added the ability to include/exclude specific named indexes 
> via WITH included_indexes=\{...} and WITH excluded_indexes=\{...}.
> A common use case is wanting to exclude *all* applicable indexes from a query 
> — to force ALLOW FILTERING behaviour, or to test what a query does without 
> any index involvement — but currently this requires enumerating every index 
> by name, which is inconvenient and brittle (the list silently becomes 
> incomplete if a new index is added to the table).
>  
> This patch adds support for the * wildcard in excluded_indexes:
>  
>   SELECT * FROM t WHERE v = 0 ALLOW FILTERING
>   WITH excluded_indexes = \{*};
>  
> The wildcard is resolved by the coordinator at validation time 
> (IndexHints.fromCQLNames) into the full concrete set of indexes currently 
> registered for the table, before the ReadCommand is sent to replicas. No 
> messaging version bump is required.
>  
> Design decisions:
>  - * is only valid in excluded_indexes. Using it in included_indexes throws 
> InvalidRequestException (WILDCARD_INCLUDED_INDEXES_ERROR), since "include all 
> indexes" has no defined semantics.
>  - * can be combined with explicit names in the same set (e.g. \{*, idx1}), 
> which is redundant but not an error.
>  - A wildcard exclusion that conflicts with an included index (e.g. 
> included_indexes=\{idx1} AND excluded_indexes=\{*}) fails with the same 
> CONFLICTING_INDEXES_ERROR as an explicit conflict, since expansion happens 
> before the conflict check.
>  
> Changes:
>  - Parser.g: add indexNameOrWildcard rule; use indexNamesOrWildcards
>   for excluded_indexes property.
>  - QualifiedName: add WILDCARD sentinel and isWildcard().
>  - IndexHints: add WILDCARD_INCLUDED_INDEXES_ERROR; expand wildcard in
>   fetchIndexes(); update fromCQLNames javadoc.
>  - IndexHints.md: document the wildcard syntax and semantics.
>  - cql3handling.py: add <identifiersOrStars> for cqlsh autocomplete.
>  - Tests: IndexHintsTest (unit), IndexHintsDistributedTest (distributed).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to