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

Ke Han commented on CASSANDRA-18628:
------------------------------------

[~brandon.williams] Thanks for the reply! But it don't work actually. Here are 
the exceptions I got when running 3.11.15.
{code:java}
cqlsh> DESC ks.tb ;
CREATE TABLE ks.tb (
    c2 int,
    c5 text,
    c3 text,
    rjr int,
    "is" int,
    c1 int,
    ds int,
    c4 text,
    PRIMARY KEY (c2, c5, c3, rjr, "is", c1, ds, c4)
) WITH CLUSTERING ORDER BY (c5 ASC, c3 ASC, rjr ASC, "is" ASC, c1 ASC, ds ASC, 
c4 ASC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND comment = ''
    AND compaction = {'class': 
'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 
'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '64', 'class': 
'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND crc_check_chance = 1.0
    AND dclocal_read_repair_chance = 0.1
    AND default_time_to_live = 0
    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_chance = 0.0
    AND speculative_retry = '99PERCENTILE';

cqlsh> SELECT c2, ds, "Is", c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 
'teststring1' AND c3 = 'teststring2' AND rJr = -1012111692;
InvalidRequest: Error from server: code=2200 [Invalid query] message="Undefined 
column name "Is""

cqlsh> SELECT c2, ds, \"Is\", c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 
'teststring1' AND c3 = 'teststring2' AND rJr = -1012111692; 
Invalid syntax at line 1, char 16
  SELECT c2, ds, \"Is\", c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 
'teststring1' AND c3 = 'teststring2' AND rJr = -1012111692; 
                 ^
cqlsh> SELECT c2, ds, 'Is', c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 
'teststring1' AND c3 = 'teststring2' AND rJr = -1012111692; 
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot 
infer type for term 'Is' in selection clause (try using a cast to force a 
type)" {code}

> Handle special column name when upgrading from 2.2.19 to 3.0.29/3.11.15
> -----------------------------------------------------------------------
>
>                 Key: CASSANDRA-18628
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18628
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Interpreter
>            Reporter: Ke Han
>            Priority: Normal
>
> When I was migrating from 2.2.19 to 3.0.29/3.11.15, I noticed some of my 
> columns could not be accessed because of the syntax problem. I had a column 
> named "Is" in the 2.x. However, after the upgrade process, when I try to 
> perform the same select command, it throws an exception since "Is" will be 
> interpreted separately. 
> I observed this after my cluster was fully upgraded. I cannot downgrade it 
> back to 2.2.19. I cannot rename this column directly either.
> h2. Steps to reproduce
> Execute the following commands in Cassandra-2.2.19 (single node)
> {code:java}
> CREATE KEYSPACE  ks WITH REPLICATION = { 'class' : 'SimpleStrategy', 
> 'replication_factor' : 2 };
> CREATE TABLE IF NOT EXISTS ks.tb (c1 INT,c2 INT,c3 TEXT,rJr INT,c4 TEXT,c5 
> TEXT,ds INT, Is INT,
> PRIMARY KEY (c2, c5, c3, rJr, Is, c1, ds, c4 ));
> SELECT c2, ds, Is, c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 'teststring1' 
> AND c3 = 'teststring2' AND rJr = -1012111692; 
>  c2 | ds | is | c4
> ----+----+----+----
> (0 rows){code}
> Then perform an upgrade to Cassandra-3.0.29/Cassandra-3.11.15
> {code:java}
> // Do the same select
> SELECT c2, ds, Is, c4 FROM ks.tb WHERE c2 = 1566089765 AND c5 = 'teststring1' 
> AND c3 = 'teststring2' AND rJr = -1012111692; 
> SyntaxException: line 1:15 no viable alternative at input 'Is' (SELECT c2, 
> ds, [Is]...){code}
> The column still exists in the table, but I cannot access it.
> I am wondering whether I can directly rename it in the new version or get 
> some prompts telling me to rename is before the upgrade process. "Is" is also 
> not marked as a reserved word in the [CQL Keywords 
> doc|https://docs.datastax.com/en/cql-oss/3.3/cql/cql_reference/keywords_r.html]).
> Any help is appreciated!



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

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

Reply via email to