-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CASANDRA-15663 (3.11) DESCRIBE KEYSPACE does not properly quote table names #1105
Conversation
authored and reviewed by Ekaterina Dimitrova, Adam Holmberg and Andres de la Pena for CASSANDRA-16659
pylib/cqlshlib/cqlhandling.py
Outdated
cql_keywords = set(( | ||
'add', 'aggregate', 'all', 'allow', 'alter', 'and', 'apply', 'as', 'asc', 'ascii', 'authorize', 'batch', 'begin', | ||
'bigint', 'blob', 'boolean', 'by', 'called', 'cast', 'clustering', 'columnfamily', 'compact', 'contains', 'count', | ||
'counter', 'create', 'custom', 'date', 'decimal', 'default', 'delete', 'desc', 'describe', 'distinct', 'double', | ||
'drop', 'duration', 'entries', 'execute', 'exists', 'filtering', 'finalfunc', 'float', 'from', 'frozen', 'full', | ||
'function', 'functions', 'grant', 'group', 'if', 'in', 'index', 'inet', 'infinity', 'initcond', 'input', 'insert', | ||
'int', 'into', 'is', 'json', 'key', 'keys', 'keyspace', 'keyspaces', 'language', 'like', 'limit', 'list', 'login', | ||
'map', 'materialized', 'mbean', 'mbeans', 'modify', 'nan', 'nologin', 'norecursive', 'nosuperuser', 'not', 'null', | ||
'of', 'on', 'options', 'or', 'order', 'partition', 'password', 'per', 'permission', 'permissions', 'primary', | ||
'rename', 'replace', 'returns', 'revoke', 'role', 'roles', 'schema', 'select', 'set', 'sfunc', 'smallint', 'static', | ||
'storage', 'stype', 'superuser', 'table', 'text', 'time', 'timestamp', 'timeuuid', 'tinyint', 'to', 'token', | ||
'trigger', 'truncate', 'ttl', 'tuple', 'type', 'unlogged', 'unset', 'update', 'use', 'user', 'users', 'using', | ||
'uuid', 'values', 'varchar', 'varint', 'view', 'where', 'with', 'writetime' | ||
)) | ||
""" | ||
Set of keywords in CQL. | ||
|
||
Derived from .../cassandra/src/java/org/apache/cassandra/cql3/Lexer.g | ||
""" | ||
|
||
cql_keywords_unreserved = set(( | ||
'aggregate', 'all', 'as', 'called', 'clustering', 'compact', 'contains', 'custom', 'exists', 'filtering', | ||
'finalfunc', 'frozen', 'function', 'functions', 'group', 'initcond', 'input', 'keys', 'keyspaces', 'language', | ||
'like', 'list', 'login', 'map', 'nologin', 'nosuperuser', 'options', 'partition', 'password', 'per', 'permission', | ||
'permissions', 'returns', 'role', 'roles', 'sfunc', 'static', 'storage', 'stype', 'superuser', 'trigger', 'tuple', | ||
'type', 'user', 'users', 'values' | ||
)) | ||
""" | ||
Set of unreserved keywords in CQL. | ||
|
||
Derived from .../cassandra/src/java/org/apache/cassandra/cql3/Parser.g | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned on the Jira ticket, I think we only need to override cql_keywords_reserved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/antlr/Lexer.g
Outdated
@@ -56,7 +56,8 @@ lexer grammar Lexer; | |||
} | |||
|
|||
// Case-insensitive keywords | |||
// When adding a new reserved keyword, add entry to o.a.c.cql3.ReservedKeywords as well | |||
// When adding a new reserved keyword, add entry to o.a.c.cql3.ReservedKeywords and | |||
// pylib/cqlshlib/cqlhandling.py::CqlParsingRuleSet.cql_keywords_reserved as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think it's pylib/cqlshlib/cqlhandling.py::cql_keywords_reserved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final Set<String> reservedSet = ImmutableSet.copyOf(reservedKeywords); | ||
private static final String FILE_NAME = "reserved_keywords.txt"; | ||
|
||
static final Set<String> reservedKeywords = getFromResource(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: we have missed the @VisibleForTesting
annotation for reservedKeywords
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CNDB-9357: merge ds-trunk to vsearch
No description provided.