Nadav Har'El created CASSANDRA-21761:
----------------------------------------

             Summary: Re-adding a dropped column with the same frozen user type 
is rejected as incompatible
                 Key: CASSANDRA-21761
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-21761
             Project: Apache Cassandra
          Issue Type: Bug
            Reporter: Nadav Har'El


After dropping a column of a frozen user type, re-adding a column with the same 
name and the *same* type fails:

{code:sql}
CREATE TYPE ks.udt (a int, b text);
CREATE TABLE ks.t (p int PRIMARY KEY, x frozen<udt>);
ALTER TABLE ks.t DROP x;
ALTER TABLE ks.t ADD x frozen<udt>;
{code}

The last statement fails with:
{noformat}
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot 
add a column 'x' of type frozen<udt>, incompatible with previously dropped 
column 'x' of type frozen<tuple<int, text>>"
{noformat}

Reproduced on Cassandra 5.0.9 and 6.0-alpha2.

The cause: a dropped column's type is recorded with its user types expanded 
into tuples ({{TableMetadata}}, {{column.type.expandUserTypes()}}), but 
{{AlterTableStatement}} compares the new, unexpanded type with it using 
{{isSerializationCompatibleWith()}}, and a {{UserType}} is not value-compatible 
with a {{TupleType}}. Expanding the new type the same way before the comparison 
would fix it.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to