[ https://issues.apache.org/jira/browse/CASSANDRA-16659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342193#comment-17342193 ]
Ekaterina Dimitrova edited comment on CASSANDRA-16659 at 5/10/21, 11:34 PM: ---------------------------------------------------------------------------- I experimented a bit and the behavior Is quite inconsistent. According to CASSANDRA-16240, in Ubuntu the newly created table should appear in "" when we run _describe tables;_ This is not the case on my Mac. Not sure whether something somewhere has been also changed since that ticket. Below is some output to show the current behavior. Seems like all operations would work but we should put _reserved_keywords in ""_ when we do _DESCRIBE_ or _USE_. I think that the best would be really this to be fixed on the driver side. [~aholmber], do you know by chance if [PYTHON-1270|https://datastax-oss.atlassian.net/browse/PYTHON-1270] is planned for work soon? {code:java} cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> use config; Improper use command. cqlsh> use "config"; cqlsh:config> CREATE TABLE emp( ... emp_id int PRIMARY KEY, ... emp_name text, ... emp_city text, ... emp_sal varint, ... emp_phone varint ... ); cqlsh:config> CREATE TABLE config.emp2( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> select emp_id from config.emp2; emp_id -------- (0 rows) cqlsh:config> describe config; Improper describe command. cqlsh:config> describe "config"; CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE config.emp ( emp_id int PRIMARY KEY, emp_city text, emp_name text, emp_phone varint, emp_sal varint ) WITH additional_write_policy = '99p' AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND cdc = false AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND extensions = {} AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair = 'BLOCKING' AND speculative_retry = '99p'; CREATE TABLE config.emp2 ( emp_id int PRIMARY KEY, emp_city text, emp_name text, emp_phone varint, emp_sal varint ) WITH additional_write_policy = '99p' AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND cdc = false AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND extensions = {} AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair = 'BLOCKING' AND speculative_retry = '99p'; cqlsh:config> drop keyspace config; cqlsh:config> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh:config> drop keyspace "config"; cqlsh:config> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh:config> describe keyspaces; config system_auth system_schema system_views system system_distributed system_traces system_virtual_schema cqlsh:config> CREATE TABLE config.config( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> describe tables; config cqlsh:config> CREATE TABLE config.profiles( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> cqlsh:config> describe tables; config profiles cqlsh:config> describe keyspaces config system_auth system_schema system_views system system_distributed system_traces system_virtual_schema cqlsh:config> drop keyspace config; cqlsh:config> describe keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views {code} was (Author: e.dimitrova): I experimented a bit and the behavior Is quite inconsistent. According to CASSANDRA-16240, in Ubuntu the newly created table should appear in "" when we run _describe tables;_ This is not the case on my Mac. Not sure whether something somewhere has been also changed since that ticket. Below is some output to show the current behavior. Seems like all operations would work but we should put _reserved_keywords in ""_ when we do describe or use. I think that the best would be really to be fixed on the driver side. [~aholmber], do you know by chance if [PYTHON-1270|https://datastax-oss.atlassian.net/browse/PYTHON-1270] is planned for work soon? {code:java} cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh> use config; Improper use command. cqlsh> use "config"; cqlsh:config> CREATE TABLE emp( ... emp_id int PRIMARY KEY, ... emp_name text, ... emp_city text, ... emp_sal varint, ... emp_phone varint ... ); cqlsh:config> CREATE TABLE config.emp2( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> select emp_id from config.emp2; emp_id -------- (0 rows) cqlsh:config> describe config; Improper describe command. cqlsh:config> describe "config"; CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true; CREATE TABLE config.emp ( emp_id int PRIMARY KEY, emp_city text, emp_name text, emp_phone varint, emp_sal varint ) WITH additional_write_policy = '99p' AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND cdc = false AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND extensions = {} AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair = 'BLOCKING' AND speculative_retry = '99p'; CREATE TABLE config.emp2 ( emp_id int PRIMARY KEY, emp_city text, emp_name text, emp_phone varint, emp_sal varint ) WITH additional_write_policy = '99p' AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND cdc = false AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND extensions = {} AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair = 'BLOCKING' AND speculative_retry = '99p'; cqlsh:config> drop keyspace config; cqlsh:config> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh:config> drop keyspace "config"; cqlsh:config> create keyspace config WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; cqlsh:config> describe keyspaces; config system_auth system_schema system_views system system_distributed system_traces system_virtual_schema cqlsh:config> CREATE TABLE config.config( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> describe tables; config cqlsh:config> CREATE TABLE config.profiles( emp_id int PRIMARY KEY, emp_name text, emp_city text, emp_sal varint, emp_phone varint ); cqlsh:config> cqlsh:config> describe tables; config profiles cqlsh:config> describe keyspaces config system_auth system_schema system_views system system_distributed system_traces system_virtual_schema cqlsh:config> drop keyspace config; cqlsh:config> describe keyspaces; system system_distributed system_traces system_virtual_schema system_auth system_schema system_views {code} > cqlsh 6.0.0 treats "config" as a reserved keyword > ------------------------------------------------- > > Key: CASSANDRA-16659 > URL: https://issues.apache.org/jira/browse/CASSANDRA-16659 > Project: Cassandra > Issue Type: Bug > Components: CQL/Interpreter > Reporter: Bowen Song > Assignee: Ekaterina Dimitrova > Priority: Normal > Fix For: 4.0-rc > > > Based on the information > [here|https://github.com/apache/cassandra/blob/cassandra-4.0-rc1/doc/source/cql/appendices.rst] > from the Cassandra 4.0 RC1, "config" is not a keyword, and certainly is not > a reserved keyword. > However, Cassandra 4.0 RC1 / cqlsh 6.0.0 cannot fully agree: > {noformat} > Connected to Test Cluster at 127.0.0.1:9042 > [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5] > Use HELP for help. > cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > cqlsh> use config; > Improper use command. > cqlsh> desc config; > Improper desc command. > cqlsh> use "config"; > cqlsh:config> desc "config"; > CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'} AND durable_writes = true; > cqlsh:config> > {noformat} > For reference: > * Non-reserved keywords, such as "all", don't have the above problem. They > can be used as keyspace name in any statement without quoting. > {noformat} > Connected to Test Cluster at 127.0.0.1:9042 > [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5] > Use HELP for help. > cqlsh> create keyspace all WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > cqlsh> use all; > cqlsh:all> desc all; > CREATE KEYSPACE all WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'} AND durable_writes = true; > cqlsh:all> > {noformat} > * Reserved keywords, such as "add", can be used as keyspace name but > requires quoting wherever it's used. > {noformat} > Connected to Test Cluster at 127.0.0.1:9042 > [cqlsh 6.0.0 | Cassandra 4.0-rc1 | CQL spec 3.4.5 | Native protocol v5] > Use HELP for help. > cqlsh> create keyspace add WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > SyntaxException: line 1:16 no viable alternative at input 'add' (create > keyspace [add]...) > cqlsh> create keyspace "add" WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > cqlsh> use add; > Improper use command. > cqlsh> use "add"; > cqlsh:add> desc add; > Improper desc command. > cqlsh:add> desc "add"; > CREATE KEYSPACE "add" WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'} AND durable_writes = true; > {noformat} > The treating of "config" in cqlsh 6.0.0 is somewhere in between, it can be > used in the "create keyspace" statement without quoting, but requires quoting > in the "use" and "desc" statements. > > I believe this is a bug in cqlsh 6.0.0, because it behaves the same way when > it's connected to a Cassandra 3.11 cluster: > {noformat} > Connected to Test Cluster at 127.0.0.1:9042 > [cqlsh 6.0.0 | Cassandra 3.11.10 | CQL spec 3.4.4 | Native protocol v4] > Use HELP for help. > cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > cqlsh> use config; > Improper use command. > cqlsh> desc config; > Improper desc command. > cqlsh> use "config"; > cqlsh:config> > {noformat} > Yet cqlsh 5.0.1 doesn't have any issue at all: > {noformat} > Connected to Test Cluster at 127.0.0.1:9042. > [cqlsh 5.0.1 | Cassandra 3.11.10 | CQL spec 3.4.4 | Native protocol v4] > Use HELP for help. > cqlsh> create keyspace config WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'}; > cqlsh> use config; > cqlsh:config> desc config; > CREATE KEYSPACE config WITH replication = {'class': 'SimpleStrategy', > 'replication_factor': '1'} AND durable_writes = true; > cqlsh:config> > {noformat} -- 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