mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-4.1' into cassandra-5.0
This commit is contained in:
commit
703dd13a54
|
|
@ -9,6 +9,7 @@
|
|||
* Add java.base/java.lang.reflect among opens for jvm11-client.options (CASSANDRA-19780)
|
||||
Merged from 4.1:
|
||||
Merged from 4.0:
|
||||
* Emit error when altering a table with non-frozen UDTs with nested non-frozen collections the same way as done upon table creation (CASSANDRA-19925)
|
||||
* Safer handling of out-of-range tokens (CASSANDRA-13704)
|
||||
* Fix memory leak in BTree.FastBuilder (CASSANDRA-19785)
|
||||
* Fix millisecond and microsecond precision for commit log replay (CASSANDRA-19448)
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import org.apache.cassandra.db.Keyspace;
|
|||
import org.apache.cassandra.db.guardrails.Guardrails;
|
||||
import org.apache.cassandra.db.marshal.AbstractType;
|
||||
|
||||
import org.apache.cassandra.db.marshal.UserType;
|
||||
import org.apache.cassandra.exceptions.InvalidRequestException;
|
||||
import org.apache.cassandra.gms.ApplicationState;
|
||||
import org.apache.cassandra.gms.Gossiper;
|
||||
|
|
@ -314,6 +315,16 @@ public abstract class AlterTableStatement extends AlterSchemaStatement
|
|||
if (isStatic && table.clusteringColumns().isEmpty())
|
||||
throw ire("Static columns are only useful (and thus allowed) if the table has at least one clustering column");
|
||||
|
||||
// check for nested non-frozen UDTs or collections in a non-frozen UDT
|
||||
if (type.isUDT() && type.isMultiCell())
|
||||
{
|
||||
for (AbstractType<?> fieldType : ((UserType) type).fieldTypes())
|
||||
{
|
||||
if (fieldType.isMultiCell())
|
||||
throw ire("Non-frozen UDTs with nested non-frozen collections are not supported for column " + column.name);
|
||||
}
|
||||
}
|
||||
|
||||
ColumnMetadata droppedColumn = table.getDroppedColumn(name.bytes);
|
||||
if (null != droppedColumn)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -183,6 +183,11 @@ public class UserTypesTest extends CQLTester
|
|||
String myType2 = KEYSPACE + '.' + typename2;
|
||||
assertInvalidMessage("Non-frozen UDTs with nested non-frozen collections are not supported",
|
||||
"CREATE TABLE " + KEYSPACE + ".wrong (k int PRIMARY KEY, v " + myType2 + ")");
|
||||
|
||||
String userType = createType("CREATE TYPE %s (userids SET<UUID>)");
|
||||
createTable("CREATE TABLE %s (id int PRIMARY KEY)");
|
||||
assertInvalidMessage("Non-frozen UDTs with nested non-frozen collections are not supported for column my_type",
|
||||
"alter TABLE %s add my_type " + userType);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in New Issue