cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcken...@apache.org
Subject [2/3] cassandra git commit: Allow updating UDT nested in non-frozen map after ALTERing the UDT
Date Tue, 14 Jun 2016 14:20:41 GMT
Allow updating UDT nested in non-frozen map after ALTERing the UDT

Patch by Alex Petrov; reviewed by jknighton for CASSANDRA-11604


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0d5984b9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0d5984b9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0d5984b9

Branch: refs/heads/trunk
Commit: 0d5984b9dbd54a42fbbe6a71a045b13a612208b6
Parents: 73a8341
Author: Alex Petrov <oleksandr.petrov@gmail.com>
Authored: Mon May 9 11:06:43 2016 +0200
Committer: Josh McKenzie <jmckenzie@apache.org>
Committed: Tue Jun 14 10:18:18 2016 -0400

----------------------------------------------------------------------
 .../cassandra/db/rows/ComplexColumnData.java    |  1 -
 .../cql3/validation/entities/UserTypesTest.java | 28 ++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0d5984b9/src/java/org/apache/cassandra/db/rows/ComplexColumnData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/rows/ComplexColumnData.java b/src/java/org/apache/cassandra/db/rows/ComplexColumnData.java
index d67d079..2a8e843 100644
--- a/src/java/org/apache/cassandra/db/rows/ComplexColumnData.java
+++ b/src/java/org/apache/cassandra/db/rows/ComplexColumnData.java
@@ -251,7 +251,6 @@ public class ComplexColumnData extends ColumnData implements Iterable<Cell>
 
         public void addCell(Cell cell)
         {
-            assert cell.column().equals(column);
             builder.add(cell);
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/0d5984b9/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
index d9df206..535f3e3 100644
--- a/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/entities/UserTypesTest.java
@@ -179,6 +179,34 @@ public class UserTypesTest extends CQLTester
     }
 
     @Test
+    public void testAlteringUserTypeNestedWithinNonFrozenMap() throws Throwable
+    {
+        String ut1 = createType("CREATE TYPE %s (a int)");
+        String columnType = KEYSPACE + "." + ut1;
+
+        createTable("CREATE TABLE %s (x int PRIMARY KEY, y map<text, frozen<" + columnType
+ ">>)");
+
+        execute("INSERT INTO %s (x, y) VALUES(1, {'firstValue': {a: 1}})");
+        assertRows(execute("SELECT * FROM %s"),
+                   row(1, map("firstValue", userType(1))));
+
+        flush();
+
+        execute("ALTER TYPE " + columnType + " ADD b int");
+        execute("UPDATE %s SET y['secondValue'] = {a: 2, b: 2} WHERE x = 1");
+
+        assertRows(execute("SELECT * FROM %s"),
+                   row(1, map("firstValue", userType(1),
+                              "secondValue", userType(2, 2))));
+
+        flush();
+
+        assertRows(execute("SELECT * FROM %s"),
+                   row(1, map("firstValue", userType(1),
+                              "secondValue", userType(2, 2))));
+    }
+
+    @Test
     public void testAlteringUserTypeNestedWithinSet() throws Throwable
     {
         // test frozen and non-frozen collections


Mime
View raw message