You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by thiranjith <th...@steadypay.co> on 2018/08/10 08:10:32 UTC

CQL data type compatibility between ascii and text

Hi, According to documentation at https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cql_data_types_c.html#cql_data_types_c__cql_data_type_compatibility we should not be able to change the column type from ascii to text. I have had a mix experience with conversion between data types on different versions of Cassandra. For example, given the following table definition: CREATE TABLE changelog (     sequence int,     description ascii,     createdby ascii,     executedon timestamp,     PRIMARY KEY (sequence, description) ) Attempting change the data type for column 'createdby' with following CQL       alter table changelog alter createdby TYPE text; gives the behaviour outlined below depending on the version of Cassandra: With [cqlsh 5.0.1 | Cassandra 3.0.16 | CQL spec 3.4.0 | Native protocol v4] InvalidRequest: Error from server: code=2200 [Invalid query] message="Altering of types is not allowed" (Expected, per documentation) With [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4] Query succeeds and change the column type to 'text' (as verified by running describe changelog and also inserting data with non-ascii chars into the column) With Cassandra 3.11.2 InvalidRequest: Error from server: code=2200 [Invalid query] message="Altering of types is not allowed" (Expected, per documentation) Can anyone please explain why it works on 3.9 and not on others? Thanks! Thira

Re: CQL data type compatibility between ascii and text

Posted by thiranjith <th...@steadypay.co>.
Thanks Yoshi! That explains it a lot :) ---- On Fri, 10 Aug 2018 18:30:25 +1000 Y K <yy...@gmail.com> wrote ---- Hi Thira, First, there's the 3.0 branch of versions and the 3.x branch of versions. http://cassandra.apache.org/doc/latest/development/patches.html#choosing-the-right-branches-to-work-on The 3.0.16 belongs to the 3.0 branch. The 3.9 and 3.11.2 belong to the 3.x. branch I believe the change was made by this: Remove alter type support https://issues.apache.org/jira/browse/CASSANDRA-12443 where it was "Fixed" in versions 3.0.11 in the 3.0 branch and in version 3.10 in 3.x branch. So 3.0.16 has the fix, 3.9 doesn't have it, but 3.11.2 has it. Best regards, Yoshi 2018年8月10日(金) 17:10 thiranjith <th...@steadypay.co>: Hi, According to documentation at https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cql_data_types_c.html#cql_data_types_c__cql_data_type_compatibility we should not be able to change the column type from ascii to text. I have had a mix experience with conversion between data types on different versions of Cassandra. For example, given the following table definition: CREATE TABLE changelog (     sequence int,     description ascii,     createdby ascii,     executedon timestamp,     PRIMARY KEY (sequence, description) ) Attempting change the data type for column 'createdby' with following CQL       alter table changelog alter createdby TYPE text; gives the behaviour outlined below depending on the version of Cassandra: With [cqlsh 5.0.1 | Cassandra 3.0.16 | CQL spec 3.4.0 | Native protocol v4] InvalidRequest: Error from server: code=2200 [Invalid query] message="Altering of types is not allowed" (Expected, per documentation) With [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native protocol v4] Query succeeds and change the column type to 'text' (as verified by running describe changelog and also inserting data with non-ascii chars into the column) With Cassandra 3.11.2 InvalidRequest: Error from server: code=2200 [Invalid query] message="Altering of types is not allowed" (Expected, per documentation) Can anyone please explain why it works on 3.9 and not on others? Thanks! Thira

Re: CQL data type compatibility between ascii and text

Posted by Y K <yy...@gmail.com>.
Hi Thira,

First, there's the 3.0 branch of versions and the 3.x branch of versions.
http://cassandra.apache.org/doc/latest/development/patches.html#choosing-the-right-branches-to-work-on

The 3.0.16 belongs to the 3.0 branch.
The 3.9 and 3.11.2 belong to the 3.x. branch

I believe the change was made by this:
Remove alter type support
https://issues.apache.org/jira/browse/CASSANDRA-12443
where it was "Fixed" in versions 3.0.11 in the 3.0 branch and in version
3.10 in 3.x branch.
So 3.0.16 has the fix, 3.9 doesn't have it, but 3.11.2 has it.

Best regards,
Yoshi


2018年8月10日(金) 17:10 thiranjith <th...@steadypay.co>:

> Hi,
>
> According to documentation at
> https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cql_data_types_c.html#cql_data_types_c__cql_data_type_compatibility we
> should not be able to change the column type from ascii to text.
>
> I have had a mix experience with conversion between data types on
> different versions of Cassandra.
>
> For example, given the following table definition:
>
>
> *CREATE TABLE changelog (*
>
> *    sequence int, *
>
> *    description ascii,*
>
> *    createdby ascii,*
>
> *    executedon timestamp,*
>
> *    PRIMARY KEY (sequence, description)*
> *)*
>
> Attempting change the data type for column 'createdby' with following CQL
>       *alter table changelog alter createdby TYPE text;*
>
> gives the behaviour outlined below depending on the version of Cassandra:
>
>
>    - With [cqlsh 5.0.1 | Cassandra 3.0.16 | CQL spec 3.4.0 | Native
>    protocol v4]
>    - InvalidRequest: Error from server: code=2200 [Invalid query]
>       message="Altering of types is not allowed" (Expected, per documentation)
>       - With [cqlsh 5.0.1 | Cassandra 3.9 | CQL spec 3.4.2 | Native
>    protocol v4]
>    - Query succeeds and change the column type to 'text' (as verified by
>       running describe changelog and also inserting data with non-ascii chars
>       into the column)
>       - With Cassandra 3.11.2
>    - InvalidRequest: Error from server: code=2200 [Invalid query]
>       message="Altering of types is not allowed" (Expected, per documentation)
>
> Can anyone please explain why it works on 3.9 and not on others?
>
> Thanks!
> Thira
>
>
>