[
https://issues.apache.org/jira/browse/CASSANDRA-18585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17750629#comment-17750629
]
Stefan Miklosovic commented on CASSANDRA-18585:
-----------------------------------------------
Few things:
1)
CreateTypeStatement contains this logic
{code}
for (CQL3Type.Raw type : rawFieldTypes)
{
if (type.isCounter())
throw ire("A user type cannot contain counters");
if (type.isUDT() && !type.isFrozen())
throw ire("A user type cannot contain non-frozen UDTs");
}
{code}
Your patch only adds the first check. I think we should also add the second one.
2)
Why is there only branch for 4.1? I think there should be branches for 4.0, 4.1
and trunk as well, no?
> Alter Type does not validate changes like Create Type does
> ----------------------------------------------------------
>
> Key: CASSANDRA-18585
> URL: https://issues.apache.org/jira/browse/CASSANDRA-18585
> Project: Cassandra
> Issue Type: Bug
> Components: Cluster/Schema
> Reporter: David Capwell
> Assignee: Roman Mushchinski
> Priority: Normal
> Fix For: 4.0.x, 4.1.x, 5.x
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Create Type attempts to block undesired field types, but this validation is
> not cared over to Alter Type Add Field; which allows you to add
> unexpected/desired types
> {code}
> Assertions.assertThatThrownBy(() -> createType("CREATE TYPE %s (f
> counter)")).hasRootCauseMessage("A user type cannot contain counters");
> String type = createType(KEYSPACE, "CREATE TYPE %s (a int)");
> schemaChange(String.format("ALTER TYPE %s.%s ADD f counter", KEYSPACE, type));
> UserType udt =
> Keyspace.open(KEYSPACE).getMetadata().types.get(UTF8Type.instance.decompose(type)).get();
> logger.warn("UDT: {}", udt);
> {code}
> {code}
> UDT:
> org.apache.cassandra.db.marshal.UserType(cql_test_keyspace,747970655f3031,61:org.apache.cassandra.db.marshal.Int32Type,66:org.apache.cassandra.db.marshal.CounterColumnType)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]