You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "PreetiToppo (via GitHub)" <gi...@apache.org> on 2026/10/21 10:47:53 UTC

[PR] Fix CREATE_INDEX regex to support quoted names and strip quotes (CASSANDRA-21784) [cassandra]

PreetiToppo opened a new pull request, #5285:
URL: https://github.com/apache/cassandra/pull/5285

   ## Summary
   
   Fixes [CASSANDRA-21784](https://issues.apache.org/jira/browse/CASSANDRA-21784).
   
   `CQLTester` parses `CREATE INDEX` statements to record the index name for cleanup. The regex for quoted identifiers was `"\w*"`, which only accepts word characters between the quotes. Legal CQL such as `CREATE INDEX "my index" ON ks.t(v)` or `CREATE INDEX "a""b" ON ks.t(v)` therefore failed to match, throwing `IllegalArgumentException: Expected valid create index query but found: ...` from the test harness.
   
   As a smaller point, `matcher.group(2)` kept the surrounding quotes, so the recorded index name was `"name"` instead of `name`.
   
   ## Changes
   
   - `test/unit/org/apache/cassandra/cql3/CQLTester.java`
     - `CREATE_INDEX_NAME_REGEX` now accepts any non-quote character, plus the `""` escape: `(\s*(\w+|\"([^\"]|\"\")*\")\s*)`.
     - The captured name has its quotes stripped via `.replace("\"", "")`.
   - `test/unit/org/apache/cassandra/cql3/CQLTesterTest.java`
     - Added `testCreateIndexWithQuotedName`, which creates indexes named `"my index"` and `"my ""quoted"" index"` and asserts both are queryable.
   
   ## Testing
   
   New test added in `CQLTesterTest`. I could not run the full suite locally (Maven Central connectivity issues in my region), so CI will be the first full run — please let me know if the test needs any adjustment.
   
   ## Impact
   
   Test infrastructure only; no server behaviour is affected.


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] Fix CREATE_INDEX regex to support quoted names and strip quotes (CASSANDRA-21784) [cassandra]

Posted by "PreetiToppo (via GitHub)" <gi...@apache.org>.
PreetiToppo commented on PR #5285:
URL: https://github.com/apache/cassandra/pull/5285#issuecomment-6314170333

   Hi, this is my first contribution to Cassandra. Could a committer please trigger CI for this PR? Thanks!


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org