[ 
https://issues.apache.org/jira/browse/CASSANDRA-15663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17376614#comment-17376614
 ] 

Andres de la Peña commented on CASSANDRA-15663:
-----------------------------------------------

[Last CI 
results|https://app.circleci.com/pipelines/github/adelapena/cassandra/638/workflows/9828c5f2-9207-44f7-bba7-d37e74842ac6]
 for the upgraded and patched driver look better.

It seems that the ideal solution would be having PYTHON-1270, but it seems that 
this isn't going to happen soon. I guess that if we are going to ship a patched 
version of the driver we should also remove the DSE-only keywords, to avoid 
problems like the one that can be seen with this example:
{code:java}
CREATE KEYSPACE node WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': '1'};
DESCRIBE KEYSPACES; # "node" is quoted
DESCRIBE KEYSPACE node; # Improper DESCRIBE command.
{code}
Alternatively, following the approach used in CASSANDRA-16659, we could try to 
modify {{cqlhandling.py}} to just override the sets of keywords in the driver's 
{{metadata}}. That way the driver's methods {{maybe_escape_name}}, 
{{protect_name}}, {{export_as_string}}, etc. would use the "injected" set of 
reserved keywords. I gave it a go 
[here|https://github.com/adelapena/cassandra/commit/9e94174e8a74cc11f6196e299eadf0d6565311b1],
 and I'm trying to run CI on it.

To add some more confusion, the lists of keywords, reserved keywords and 
unreserved keywords defined in the driver don't exactly match what is defined 
in {{Parser.g}}, {{Lexer.g}} and {{ReservedKeywords.java}}. The driver assumes 
that the reserved keywords are the difference between all the keywords and the 
unreserved keywords (see 
[here|https://github.com/Gerrrr/python-driver/blob/master/cassandra/metadata.py#L90-L93]).
 However, it seems that 
[{{Lexer.g}}|https://github.com/apache/cassandra/blob/cassandra-3.11/src/antlr/Lexer.g#L58-L204]
 contains some keywords that aren't included in neither the list of [unreserved 
keywords defined in 
{{Parser.g}}|https://github.com/apache/cassandra/blob/cassandra-3.11/src/antlr/Parser.g#L1640-L1687]
 nor in the [list of reserved keywords defined in 
{{ReservedKeywords.java}}|https://github.com/apache/cassandra/blob/cassandra-3.11/src/java/org/apache/cassandra/cql3/ReservedKeywords.java#L29-L92].
 These keywords that aren't included in none of the reserved/unreserved sets 
are {{varint}}, {{int}}, {{text}}, {{float}}, {{boolean}}, {{ttl}}, 
{{duration}}, {{ascii}}, {{smallint}}, {{uuid}}, {{distinct}}, {{bigint}}, 
{{json}}, {{blob}}, {{inet}}, {{timeuuid}}, {{varchar}}, {{timestamp}}, 
{{key}}, {{date}}, {{count}}, {{double}}, {{decimal}}, {{counter}}, {{cast}}, 
{{tinyint}}, {{writetime}} and {{time}}. The sets of keywords matching the 
contents of those files would look [like 
this|https://github.com/adelapena/cassandra/blob/b15a8bbb25a35f17617966aa5d4e056d3496a6f7/pylib/cqlshlib/cqlhandling.py#L26-L71].

> DESCRIBE KEYSPACE does not properly quote table names
> -----------------------------------------------------
>
>                 Key: CASSANDRA-15663
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15663
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Syntax
>            Reporter: Oskar Liljeblad
>            Assignee: Aleksandr Sorokoumov
>            Priority: Normal
>              Labels: pull-request-available
>             Fix For: 3.11.x
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> How to reproduce (3.11.6) - cqlsh:
> {code}
> CREATE KEYSPACE test1 WITH replication = \{'class': 'SimpleStrategy', 
> 'replication_factor': '1'} AND durable_writes = true;
> CREATE TABLE test1."default" (id text PRIMARY KEY, data text, etag text);
> DESCRIBE KEYSPACE test1;
> {code}
> Output will be:
> {code}
> CREATE TABLE test1.default (
>  id text PRIMARY KEY,
>  data text,
>  etag text
> ) WITH [..]
> {code}
> Output should be:
> {code}
> CREATE TABLE test1."default" (
>  id text PRIMARY KEY,
>  data text,
>  etag text
> ) WITH [..]
> {code}
>  If you try to run {{CREATE TABLE test1.default [..]}} you will get an error 
> SyntaxException: line 1:19 no viable alternative at input 'default' (CREATE 
> TABLE test1.[default]...)
> Oskar Liljeblad
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to