cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [14/16] cassandra git commit: Merge branch 'cassandra-3.11' into trunk
Date Tue, 05 Sep 2017 06:08:41 GMT
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6fb8302/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
index cb15e83,6803230..f2d8f2a
--- a/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ViewFilteringTest.java
@@@ -80,7 -84,7 +81,7 @@@ public class ViewFilteringTest extends 
      {
          executeNet(protocolVersion, query, params);
          while (!(((SEPExecutor) StageManager.getStage(Stage.VIEW_MUTATION)).getPendingTasks()
== 0
--            && ((SEPExecutor) StageManager.getStage(Stage.VIEW_MUTATION)).getActiveCount()
== 0))
++                 && ((SEPExecutor) StageManager.getStage(Stage.VIEW_MUTATION)).getActiveCount()
== 0))
          {
              Thread.sleep(1);
          }
@@@ -92,6 -96,324 +93,318 @@@
          views.remove(name);
      }
  
 -    private static void waitForView(String keyspace, String view) throws InterruptedException
 -    {
 -        while (!SystemKeyspace.isViewBuilt(keyspace, view))
 -            Thread.sleep(10);
 -    }
 -
 -    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-13826
++    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-11500
+     @Ignore
+     @Test
+     public void testViewFilteringWithFlush() throws Throwable
+     {
+         testViewFiltering(true);
+     }
+ 
 -    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-13826
++    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-11500
+     @Ignore
+     @Test
+     public void testViewFilteringWithoutFlush() throws Throwable
+     {
+         testViewFiltering(false);
+     }
+ 
+     public void testViewFiltering(boolean flush) throws Throwable
+     {
+         // CASSANDRA-13547: able to shadow entire view row if base column used in filter
condition is modified
+         createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY (a))");
+ 
+         execute("USE " + keyspace());
+         executeNet(protocolVersion, "USE " + keyspace());
+ 
+         createView("mv_test1",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE a IS NOT NULL
AND b IS NOT NULL and c = 1  PRIMARY KEY (a, b)");
+         createView("mv_test2",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT c, d FROM %%s WHERE a IS NOT NULL
AND b IS NOT NULL and c = 1 and d = 1 PRIMARY KEY (a, b)");
+         createView("mv_test3",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT a, b, c, d FROM %%s WHERE a IS
NOT NULL AND b IS NOT NULL PRIMARY KEY (a, b)");
+         createView("mv_test4",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT c FROM %%s WHERE a IS NOT NULL
AND b IS NOT NULL and c = 1 PRIMARY KEY (a, b)");
+         createView("mv_test5",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT c FROM %%s WHERE a IS NOT NULL
and d = 1 PRIMARY KEY (a, d)");
+         createView("mv_test6",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT c FROM %%s WHERE a = 1 and d IS
NOT NULL PRIMARY KEY (a, d)");
+ 
+         waitForView(keyspace(), "mv_test1");
+         waitForView(keyspace(), "mv_test2");
+         waitForView(keyspace(), "mv_test3");
+         waitForView(keyspace(), "mv_test4");
+         waitForView(keyspace(), "mv_test5");
+         waitForView(keyspace(), "mv_test6");
+ 
+         Keyspace ks = Keyspace.open(keyspace());
+         ks.getColumnFamilyStore("mv_test1").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test2").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test3").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test4").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test5").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test6").disableAutoCompaction();
+ 
+ 
+         execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?) using timestamp 0", 1,
1, 1, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         // views should be updated.
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 1));
+ 
+         updateView("UPDATE %s using timestamp 1 set c = ? WHERE a=?", 0, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 0, 1));
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 0));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 0));
+ 
+         updateView("UPDATE %s using timestamp 2 set c = ? WHERE a=?", 1, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         // row should be back in views.
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 1));
+ 
+         updateView("UPDATE %s using timestamp 3 set d = ? WHERE a=?", 0, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, 0));
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, 0));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRowCount(execute("SELECT * FROM mv_test5"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 0, 1));
+ 
+         updateView("UPDATE %s using timestamp 4 set c = ? WHERE a=?", 0, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 0, 0));
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test5"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 0, 0));
+ 
+         updateView("UPDATE %s using timestamp 5 set d = ? WHERE a=?", 1, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         // should not update as c=0
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 0, 1));
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 0));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 0));
+ 
+         updateView("UPDATE %s using timestamp 6 set c = ? WHERE a=?", 1, 1);
+ 
+         // row should be back in views.
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 1));
+ 
+         updateView("UPDATE %s using timestamp 7 set b = ? WHERE a=?", 2, 1);
+         if (flush)
+         {
+             FBUtilities.waitOnFutures(ks.flush());
+             for (String view : views)
+                 ks.getColumnFamilyStore(view).forceMajorCompaction();
+         }
+         // row should be back in views.
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 2, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 2, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 2, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 2, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 1));
+ 
+         updateView("DELETE b, c FROM %s using timestamp 6 WHERE a=?", 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT * FROM %s"), row(1, 2, null, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 2, null, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, null));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, null));
+ 
+         updateView("DELETE FROM %s using timestamp 8 where a=?", 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test3"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test5"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test6"), 0);
+ 
+         updateView("UPDATE %s using timestamp 9 set b = ?,c = ? where a=?", 1, 1, 1); //
upsert
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, null));
+         assertRows(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, null));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRows(execute("SELECT * FROM mv_test5"));
+         assertRows(execute("SELECT * FROM mv_test6"));
+ 
+         updateView("DELETE FROM %s using timestamp 10 where a=?", 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test3"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test5"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test6"), 0);
+ 
+         execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?) using timestamp 11", 1,
1, 1, 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         // row should be back in views.
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test5"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test6"), row(1, 1, 1));
+ 
+         updateView("DELETE FROM %s using timestamp 12 where a=?", 1);
+         if (flush)
+             FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowCount(execute("SELECT * FROM mv_test1"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test2"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test3"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test4"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test5"), 0);
+         assertRowCount(execute("SELECT * FROM mv_test6"), 0);
+ 
+         dropView("mv_test1");
+         dropView("mv_test2");
+         dropView("mv_test3");
+         dropView("mv_test4");
+         dropView("mv_test5");
+         dropView("mv_test6");
+         dropTable("DROP TABLE %s");
+     }
+ 
 -    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-13826
++    // TODO will revise the non-pk filter condition in MV, see CASSANDRA-11500
+     @Ignore
+     @Test
+     public void testMVFilteringWithComplexColumn() throws Throwable
+     {
+         createTable("CREATE TABLE %s (a int, b int, c int, l list<int>, s set<int>,
m map<int,int>, PRIMARY KEY (a, b))");
+ 
+         execute("USE " + keyspace());
+         executeNet(protocolVersion, "USE " + keyspace());
+ 
+         createView("mv_test1",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT a,b,c FROM %%s WHERE a IS NOT
NULL AND b IS NOT NULL AND c IS NOT NULL "
+                    + "and l contains (1) AND s contains (1) AND m contains key (1) PRIMARY
KEY (a, b, c)");
+         createView("mv_test2",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT a,b FROM %%s WHERE a IS NOT NULL
and b IS NOT NULL AND l contains (1) PRIMARY KEY (a, b)");
+         createView("mv_test3",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT a,b FROM %%s WHERE a IS NOT NULL
AND b IS NOT NULL AND s contains (1) PRIMARY KEY (a, b)");
+         createView("mv_test4",
+                    "CREATE MATERIALIZED VIEW %s AS SELECT a,b FROM %%s WHERE a IS NOT NULL
AND b IS NOT NULL AND m contains key (1) PRIMARY KEY (a, b)");
+ 
+         waitForView(keyspace(), "mv_test1");
+         waitForView(keyspace(), "mv_test2");
+         waitForView(keyspace(), "mv_test3");
+         waitForView(keyspace(), "mv_test4");
+ 
+         // not able to drop base column filtered in view
+         assertInvalidMessage("Cannot drop column l, depended on by materialized views",
"ALTER TABLE %s DROP l");
+         assertInvalidMessage("Cannot drop column s, depended on by materialized views",
"ALTER TABLE %S DROP s");
+         assertInvalidMessage("Cannot drop column m, depended on by materialized views",
"ALTER TABLE %s DROP m");
+ 
+         Keyspace ks = Keyspace.open(keyspace());
+         ks.getColumnFamilyStore("mv_test1").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test2").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test3").disableAutoCompaction();
+         ks.getColumnFamilyStore("mv_test4").disableAutoCompaction();
+ 
+         execute("INSERT INTO %s (a, b, c, l, s, m) VALUES (?, ?, ?, ?, ?, ?) ",
+                 1,
+                 1,
+                 1,
+                 list(1, 1, 2),
+                 set(1, 2),
+                 map(1, 1, 2, 2));
+         FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1));
+ 
+ 
+         execute("UPDATE %s SET l=l-[1] WHERE a = 1 AND b = 1" );
+         FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1));
+ 
+         execute("UPDATE %s SET s=s-{2}, m=m-{2} WHERE a = 1 AND b = 1");
+         FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT a,b,c FROM %s"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"), row(1, 1));
+ 
+         execute("UPDATE %s SET  m=m-{1} WHERE a = 1 AND b = 1");
+         FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT a,b,c FROM %s"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"));
+ 
+         // filter conditions result not changed
+         execute("UPDATE %s SET  l=l+[2], s=s-{0}, m=m+{3:3} WHERE a = 1 AND b = 1");
+         FBUtilities.waitOnFutures(ks.flush());
+ 
+         assertRowsIgnoringOrder(execute("SELECT a,b,c FROM %s"), row(1, 1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test1"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test2"));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test3"), row(1, 1));
+         assertRowsIgnoringOrder(execute("SELECT * FROM mv_test4"));
+     }
+ 
      @Test
      public void testMVCreationSelectRestrictions() throws Throwable
      {
@@@ -1440,61 -1753,61 +1753,61 @@@
                               "udtval";
  
          createTable(
-                 "CREATE TABLE %s (" +
-                         "asciival ascii, " +
-                         "bigintval bigint, " +
-                         "blobval blob, " +
-                         "booleanval boolean, " +
-                         "dateval date, " +
-                         "decimalval decimal, " +
-                         "doubleval double, " +
-                         "floatval float, " +
-                         "inetval inet, " +
-                         "intval int, " +
-                         "textval text, " +
-                         "timeval time, " +
-                         "timestampval timestamp, " +
-                         "timeuuidval timeuuid, " +
-                         "uuidval uuid," +
-                         "varcharval varchar, " +
-                         "varintval varint, " +
-                         "frozenlistval frozen<list<int>>, " +
-                         "frozensetval frozen<set<uuid>>, " +
-                         "frozenmapval frozen<map<ascii, int>>," +
-                         "tupleval frozen<tuple<int, ascii, uuid>>," +
-                         "udtval frozen<" + myType + ">, " +
-                         "PRIMARY KEY (" + columnNames + "))");
 -                    "CREATE TABLE %s (" +
 -                            "asciival ascii, " +
 -                            "bigintval bigint, " +
 -                            "blobval blob, " +
 -                            "booleanval boolean, " +
 -                            "dateval date, " +
 -                            "decimalval decimal, " +
 -                            "doubleval double, " +
 -                            "floatval float, " +
 -                            "inetval inet, " +
 -                            "intval int, " +
 -                            "textval text, " +
 -                            "timeval time, " +
 -                            "timestampval timestamp, " +
 -                            "timeuuidval timeuuid, " +
 -                            "uuidval uuid," +
 -                            "varcharval varchar, " +
 -                            "varintval varint, " +
 -                            "frozenlistval frozen<list<int>>, " +
 -                            "frozensetval frozen<set<uuid>>, " +
 -                            "frozenmapval frozen<map<ascii, int>>," +
 -                            "tupleval frozen<tuple<int, ascii, uuid>>," +
 -                            "udtval frozen<" + myType + ">, " +
 -                            "PRIMARY KEY (" + columnNames + "))");
++        "CREATE TABLE %s (" +
++        "asciival ascii, " +
++        "bigintval bigint, " +
++        "blobval blob, " +
++        "booleanval boolean, " +
++        "dateval date, " +
++        "decimalval decimal, " +
++        "doubleval double, " +
++        "floatval float, " +
++        "inetval inet, " +
++        "intval int, " +
++        "textval text, " +
++        "timeval time, " +
++        "timestampval timestamp, " +
++        "timeuuidval timeuuid, " +
++        "uuidval uuid," +
++        "varcharval varchar, " +
++        "varintval varint, " +
++        "frozenlistval frozen<list<int>>, " +
++        "frozensetval frozen<set<uuid>>, " +
++        "frozenmapval frozen<map<ascii, int>>," +
++        "tupleval frozen<tuple<int, ascii, uuid>>," +
++        "udtval frozen<" + myType + ">, " +
++        "PRIMARY KEY (" + columnNames + "))");
  
          execute("USE " + keyspace());
          executeNet(protocolVersion, "USE " + keyspace());
  
  
          createView(
-                 "mv_test",
-                 "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE " +
-                         "asciival = 'abc' AND " +
-                         "bigintval = 123 AND " +
-                         "blobval = 0xfeed AND " +
-                         "booleanval = true AND " +
-                         "dateval = '1987-03-23' AND " +
-                         "decimalval = 123.123 AND " +
-                         "doubleval = 123.123 AND " +
-                         "floatval = 123.123 AND " +
-                         "inetval = '127.0.0.1' AND " +
-                         "intval = 123 AND " +
-                         "textval = 'abc' AND " +
-                         "timeval = '07:35:07.000111222' AND " +
-                         "timestampval = 123123123 AND " +
-                         "timeuuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
-                         "uuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
-                         "varcharval = 'abc' AND " +
-                         "varintval = 123123123 AND " +
-                         "frozenlistval = [1, 2, 3] AND " +
-                         "frozensetval = {6BDDC89A-5644-11E4-97FC-56847AFE9799} AND " +
-                         "frozenmapval = {'a': 1, 'b': 2} AND " +
-                         "tupleval = (1, 'foobar', 6BDDC89A-5644-11E4-97FC-56847AFE9799)
AND " +
-                         "udtval = {a: 1, b: 6BDDC89A-5644-11E4-97FC-56847AFE9799, c: {'foo',
'bar'}} " +
-                         "PRIMARY KEY (" + columnNames + ")");
 -                   "mv_test",
 -                   "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE " +
 -                           "asciival = 'abc' AND " +
 -                           "bigintval = 123 AND " +
 -                           "blobval = 0xfeed AND " +
 -                           "booleanval = true AND " +
 -                           "dateval = '1987-03-23' AND " +
 -                           "decimalval = 123.123 AND " +
 -                           "doubleval = 123.123 AND " +
 -                           "floatval = 123.123 AND " +
 -                           "inetval = '127.0.0.1' AND " +
 -                           "intval = 123 AND " +
 -                           "textval = 'abc' AND " +
 -                           "timeval = '07:35:07.000111222' AND " +
 -                           "timestampval = 123123123 AND " +
 -                           "timeuuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
 -                           "uuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
 -                           "varcharval = 'abc' AND " +
 -                           "varintval = 123123123 AND " +
 -                           "frozenlistval = [1, 2, 3] AND " +
 -                           "frozensetval = {6BDDC89A-5644-11E4-97FC-56847AFE9799} AND "
+
 -                           "frozenmapval = {'a': 1, 'b': 2} AND " +
 -                           "tupleval = (1, 'foobar', 6BDDC89A-5644-11E4-97FC-56847AFE9799)
AND " +
 -                           "udtval = {a: 1, b: 6BDDC89A-5644-11E4-97FC-56847AFE9799, c:
{'foo', 'bar'}} " +
 -                           "PRIMARY KEY (" + columnNames + ")");
++        "mv_test",
++        "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE " +
++        "asciival = 'abc' AND " +
++        "bigintval = 123 AND " +
++        "blobval = 0xfeed AND " +
++        "booleanval = true AND " +
++        "dateval = '1987-03-23' AND " +
++        "decimalval = 123.123 AND " +
++        "doubleval = 123.123 AND " +
++        "floatval = 123.123 AND " +
++        "inetval = '127.0.0.1' AND " +
++        "intval = 123 AND " +
++        "textval = 'abc' AND " +
++        "timeval = '07:35:07.000111222' AND " +
++        "timestampval = 123123123 AND " +
++        "timeuuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
++        "uuidval = 6BDDC89A-5644-11E4-97FC-56847AFE9799 AND " +
++        "varcharval = 'abc' AND " +
++        "varintval = 123123123 AND " +
++        "frozenlistval = [1, 2, 3] AND " +
++        "frozensetval = {6BDDC89A-5644-11E4-97FC-56847AFE9799} AND " +
++        "frozenmapval = {'a': 1, 'b': 2} AND " +
++        "tupleval = (1, 'foobar', 6BDDC89A-5644-11E4-97FC-56847AFE9799) AND " +
++        "udtval = {a: 1, b: 6BDDC89A-5644-11E4-97FC-56847AFE9799, c: {'foo', 'bar'}} " +
++        "PRIMARY KEY (" + columnNames + ")");
  
          execute("INSERT INTO %s (" + columnNames + ") VALUES (" +
                  "'abc'," +
@@@ -1568,77 -1881,77 +1881,77 @@@
              Thread.sleep(10);
  
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 0),
--            row(1, 1, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 0),
++                                row(1, 1, 1, 0)
          );
  
          // insert new rows that do not match the filter
          execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 2, 0, 0, 0);
          execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 2, 1, 2, 0);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 0),
--            row(1, 1, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 0),
++                                row(1, 1, 1, 0)
          );
  
          // insert new row that does match the filter
          execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 2, 1, 0);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 0),
--            row(1, 1, 1, 0),
--            row(1, 2, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 0),
++                                row(1, 1, 1, 0),
++                                row(1, 2, 1, 0)
          );
  
          // update rows that don't match the filter
          execute("UPDATE %s SET d = ? WHERE a = ? AND b = ?", 2, 2, 0);
          execute("UPDATE %s SET d = ? WHERE a = ? AND b = ?", 1, 2, 1);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 0),
--            row(1, 1, 1, 0),
--            row(1, 2, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 0),
++                                row(1, 1, 1, 0),
++                                row(1, 2, 1, 0)
          );
  
          // update a row that does match the filter
          execute("UPDATE %s SET d = ? WHERE a = ? AND b = ?", 1, 1, 0);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 1),
--            row(1, 1, 1, 0),
--            row(1, 2, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 1),
++                                row(1, 1, 1, 0),
++                                row(1, 2, 1, 0)
          );
  
          // delete rows that don't match the filter
          execute("DELETE FROM %s WHERE a = ? AND b = ?", 2, 0);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 1),
--            row(1, 1, 1, 0),
--            row(1, 2, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 1),
++                                row(1, 1, 1, 0),
++                                row(1, 2, 1, 0)
          );
  
          // delete a row that does match the filter
          execute("DELETE FROM %s WHERE a = ? AND b = ?", 1, 2);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0),
--            row(1, 0, 1, 1),
--            row(1, 1, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0),
++                                row(1, 0, 1, 1),
++                                row(1, 1, 1, 0)
          );
  
          // delete a partition that matches the filter
          execute("DELETE FROM %s WHERE a = ?", 1);
          assertRowsIgnoringOrder(execute("SELECT a, b, c, d FROM mv_test"),
--            row(0, 0, 1, 0),
--            row(0, 1, 1, 0)
++                                row(0, 0, 1, 0),
++                                row(0, 1, 1, 0)
          );
  
          dropView("mv_test");
@@@ -1726,6 -2039,6 +2039,7 @@@
  
          //Tombstone c
          executeNet(protocolVersion, "DELETE FROM %s WHERE a = ? and b = ?", 0, 0);
++        assertRowsIgnoringOrder(execute("SELECT d from mv"));
          assertRows(execute("SELECT d from mv"));
  
          //Add back without D
@@@ -1745,18 -2058,18 +2059,18 @@@
          // delete with timestamp 0 (which should only delete d)
          executeNet(protocolVersion, "DELETE FROM %s USING TIMESTAMP 0 WHERE a = ? AND b
= ?", 1, 0);
          assertRows(execute("SELECT a, b, c, d, e from mv WHERE c = ? and a = ? and b = ?",
1, 1, 0),
--            row(1, 0, 1, null, 0)
++                   row(1, 0, 1, null, 0)
          );
  
          executeNet(protocolVersion, "UPDATE %s USING TIMESTAMP 2 SET c = ? WHERE a = ? AND
b = ?", 1, 1, 1);
          executeNet(protocolVersion, "UPDATE %s USING TIMESTAMP 3 SET c = ? WHERE a = ? AND
b = ?", 1, 1, 0);
          assertRows(execute("SELECT a, b, c, d, e from mv WHERE c = ? and a = ? and b = ?",
1, 1, 0),
--            row(1, 0, 1, null, 0)
++                   row(1, 0, 1, null, 0)
          );
  
          executeNet(protocolVersion, "UPDATE %s USING TIMESTAMP 3 SET d = ? WHERE a = ? AND
b = ?", 0, 1, 0);
          assertRows(execute("SELECT a, b, c, d, e from mv WHERE c = ? and a = ? and b = ?",
1, 1, 0),
--            row(1, 0, 1, 0, 0)
++                   row(1, 0, 1, 0, 0)
          );
      }
  
@@@ -1766,9 -2079,9 +2080,9 @@@
          // Regression test for CASSANDRA-10910
  
          createTable("CREATE TABLE %s (" +
--            "k int PRIMARY KEY, " +
--            "c int, " +
--            "val int)");
++                    "k int PRIMARY KEY, " +
++                    "c int, " +
++                    "val int)");
  
          execute("USE " + keyspace());
          executeNet(protocolVersion, "USE " + keyspace());
@@@ -1794,10 -2107,10 +2108,10 @@@
      public void testOldTimestampsWithRestrictions() throws Throwable
      {
          createTable("CREATE TABLE %s (" +
--            "k int, " +
--            "c int, " +
--            "val text, " + "" +
--            "PRIMARY KEY(k, c))");
++                    "k int, " +
++                    "c int, " +
++                    "val text, " + "" +
++                    "PRIMARY KEY(k, c))");
  
          execute("USE " + keyspace());
          executeNet(protocolVersion, "USE " + keyspace());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/e6fb8302/test/unit/org/apache/cassandra/cql3/ViewTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/ViewTest.java
index e65ea31,a4d227a..9421264
--- a/test/unit/org/apache/cassandra/cql3/ViewTest.java
+++ b/test/unit/org/apache/cassandra/cql3/ViewTest.java
@@@ -122,7 -121,7 +121,6 @@@ public class ViewTest extends CQLTeste
          Assert.assertEquals(0, execute("select * from view1").size());
      }
  
--
      @Test
      public void createMvWithUnrestrictedPKParts() throws Throwable
      {
@@@ -400,9 -399,9 +398,6 @@@
          executeNet(protocolVersion, "INSERT INTO %s (a, b, c, d) VALUES (0, 0, 1, 0) USING
TIMESTAMP 0");
          assertRows(execute("SELECT d from mv WHERE c = ? and a = ? and b = ?", 1, 0, 0),
row(0));
  
--        if (flush)
--            FBUtilities.waitOnFutures(ks.flush());
--
          //update c's timestamp TS=2
          executeNet(protocolVersion, "UPDATE %s USING TIMESTAMP 2 SET c = ? WHERE a = ? and
b = ? ", 1, 0, 0);
          assertRows(execute("SELECT d from mv WHERE c = ? and a = ? and b = ?", 1, 0, 0),
row(0));
@@@ -1233,9 -1234,9 +1230,9 @@@
      public void testCreateMvWithTTL() throws Throwable
      {
          createTable("CREATE TABLE %s (" +
--                "k int PRIMARY KEY, " +
--                "c int, " +
--                "val int) WITH default_time_to_live = 60");
++                    "k int PRIMARY KEY, " +
++                    "c int, " +
++                    "val int) WITH default_time_to_live = 60");
  
          execute("USE " + keyspace());
          executeNet(protocolVersion, "USE " + keyspace());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message