http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java 
b/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
deleted file mode 100644
index b380b1e..0000000
--- a/test/unit/org/apache/cassandra/cql3/MultiColumnRelationTest.java
+++ /dev/null
@@ -1,936 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.junit.Test;
-
-public class MultiColumnRelationTest extends CQLTester
-{
-    @Test
-    public void testSingleClusteringInvalidQueries() throws Throwable
-    {
-        for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" 
})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, 
b))" + compactOption);
-
-            assertInvalidSyntax("SELECT * FROM %s WHERE () = (?, ?)", 1, 2);
-            assertInvalidMessage("b cannot be restricted by more than one 
relation if it includes an Equal",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b) = (?) 
AND (b) > (?)", 0, 0);
-            assertInvalidMessage("More than one restriction was found for the 
start bound on b",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b) > (?) 
AND (b) > (?)", 0, 1);
-            assertInvalidMessage("Multi-column relations can only be applied 
to clustering columns but was applied to: a",
-                                 "SELECT * FROM %s WHERE (a, b) = (?, ?)", 0, 
0);
-        }
-    }
-
-    @Test
-    public void testMultiClusteringInvalidQueries() throws Throwable
-    {
-        for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" 
})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY 
KEY (a, b, c, d))" + compactOption);
-
-            assertInvalidSyntax("SELECT * FROM %s WHERE a = 0 AND (b, c) > 
()");
-            assertInvalidMessage("Expected 2 elements in value tuple, but got 
3: (?, ?, ?)",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b, c) > 
(?, ?, ?)", 1, 2, 3);
-            assertInvalidMessage("Invalid null value in condition for column 
c",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b, c) > 
(?, ?)", 1, null);
-
-            // Wrong order of columns
-            assertInvalidMessage("Clustering columns must appear in the 
PRIMARY KEY order in multi-column relations: (d, c, b) = (?, ?, ?)",
-                                 "SELECT * FROM %s WHERE a = 0 AND (d, c, b) = 
(?, ?, ?)", 0, 0, 0);
-            assertInvalidMessage("Clustering columns must appear in the 
PRIMARY KEY order in multi-column relations: (d, c, b) > (?, ?, ?)",
-                                 "SELECT * FROM %s WHERE a = 0 AND (d, c, b) > 
(?, ?, ?)", 0, 0, 0);
-
-            // Wrong number of values
-            assertInvalidMessage("Expected 3 elements in value tuple, but got 
2: (?, ?)",
-                                 "SELECT * FROM %s WHERE a=0 AND (b, c, d) IN 
((?, ?))", 0, 1);
-            assertInvalidMessage("Expected 3 elements in value tuple, but got 
5: (?, ?, ?, ?, ?)",
-                                 "SELECT * FROM %s WHERE a=0 AND (b, c, d) IN 
((?, ?, ?, ?, ?))", 0, 1, 2, 3, 4);
-
-            // Missing first clustering column
-            assertInvalidMessage("PRIMARY KEY column \"c\" cannot be 
restricted as preceding column \"b\" is not restricted",
-                                 "SELECT * FROM %s WHERE a = 0 AND (c, d) = 
(?, ?)", 0, 0);
-            assertInvalidMessage("PRIMARY KEY column \"c\" cannot be 
restricted as preceding column \"b\" is not restricted",
-                                 "SELECT * FROM %s WHERE a = 0 AND (c, d) > 
(?, ?)", 0, 0);
-
-            // Nulls
-            assertInvalidMessage("Invalid null value in condition for columns: 
[b, c, d]",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b, c, d) 
IN ((?, ?, ?))", 1, 2, null);
-
-            // Wrong type for 'd'
-            assertInvalid("SELECT * FROM %s WHERE a = 0 AND (b, c, d) = (?, ?, 
?)", 1, 2, "foobar");
-            assertInvalid("SELECT * FROM %s WHERE a = 0 AND b = (?, ?, ?)", 1, 
2, 3);
-
-            // Mix single and tuple inequalities
-            assertInvalidMessage("Mixing single column relations and multi 
column relations on clustering columns is not allowed",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b, c, d) > 
(?, ?, ?) AND b < ?", 0, 1, 0, 1);
-            assertInvalidMessage("Mixing single column relations and multi 
column relations on clustering columns is not allowed",
-                                 "SELECT * FROM %s WHERE a = 0 AND (b, c, d) > 
(?, ?, ?) AND c < ?", 0, 1, 0, 1);
-            assertInvalidMessage("Mixing single column relations and multi 
column relations on clustering columns is not allowed",
-                                 "SELECT * FROM %s WHERE a = 0 AND b > ? AND 
(b, c, d) < (?, ?, ?)", 1, 1, 1, 0);
-            assertInvalidMessage("Mixing single column relations and multi 
column relations on clustering columns is not allowed",
-                                 "SELECT * FROM %s WHERE a = 0 AND c > ? AND 
(b, c, d) < (?, ?, ?)", 1, 1, 1, 0);
-
-            assertInvalidMessage("Multi-column relations can only be applied 
to clustering columns but was applied to: a",
-                                 "SELECT * FROM %s WHERE (a, b, c, d) IN ((?, 
?, ?, ?))", 0, 1, 2, 3);
-            assertInvalidMessage("PRIMARY KEY column \"c\" cannot be 
restricted as preceding column \"b\" is not restricted",
-                                 "SELECT * FROM %s WHERE (c, d) IN ((?, ?))", 
0, 1);
-
-            assertInvalidMessage("Clustering column \"c\" cannot be restricted 
(preceding column \"b\" is restricted by a non-EQ relation)",
-                                 "SELECT * FROM %s WHERE a = ? AND b > ?  AND 
(c, d) IN ((?, ?))", 0, 0, 0, 0);
-
-            assertInvalidMessage("Clustering column \"c\" cannot be restricted 
(preceding column \"b\" is restricted by a non-EQ relation)",
-                                 "SELECT * FROM %s WHERE a = ? AND b > ?  AND 
(c, d) > (?, ?)", 0, 0, 0, 0);
-            assertInvalidMessage("PRIMARY KEY column \"c\" cannot be 
restricted (preceding column \"b\" is restricted by a non-EQ relation)",
-                                 "SELECT * FROM %s WHERE a = ? AND (c, d) > 
(?, ?) AND b > ?  ", 0, 0, 0, 0);
-            assertInvalidMessage("Column \"c\" cannot be restricted by two 
tuple-notation inequalities not starting with the same column",
-                                 "SELECT * FROM %s WHERE a = ? AND (b, c) > 
(?, ?) AND (b) < (?) AND (c) < (?)", 0, 0, 0, 0, 0);
-            assertInvalidMessage("Column \"c\" cannot be restricted by two 
tuple-notation inequalities not starting with the same column",
-                                 "SELECT * FROM %s WHERE a = ? AND (c) < (?) 
AND (b, c) > (?, ?) AND (b) < (?)", 0, 0, 0, 0, 0);
-            assertInvalidMessage("Clustering column \"c\" cannot be restricted 
(preceding column \"b\" is restricted by a non-EQ relation)",
-                                 "SELECT * FROM %s WHERE a = ? AND (b) < (?) 
AND (c) < (?) AND (b, c) > (?, ?)", 0, 0, 0, 0, 0);
-
-            assertInvalidMessage("Column \"c\" cannot be restricted by two 
tuple-notation inequalities not starting with the same column",
-                                 "SELECT * FROM %s WHERE a = ? AND (b, c) > 
(?, ?) AND (c) < (?)", 0, 0, 0, 0);
-        }
-    }
-
-    @Test
-    public void testMultiAndSingleColumnRelationMix() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY 
KEY (a, b, c, d))" + compactOption);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 1);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 1);
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) = (?, ?)", 0, 1, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b IN (?, ?) 
and (c, d) = (?, ?)", 0, 0, 1, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c) 
IN ((?))", 0, 1, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b IN (?, ?) 
and (c) IN ((?))", 0, 0, 1, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c) 
IN ((?), (?))", 0, 1, 0, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) IN ((?, ?))", 0, 1, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) IN ((?, ?), (?, ?))", 0, 1, 0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b IN (?, ?) 
and (c, d) IN ((?, ?), (?, ?))", 0, 0, 1, 0, 0, 1, 1),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) > (?, ?)", 0, 1, 0, 0),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b IN (?, ?) 
and (c, d) > (?, ?)", 0, 0, 1, 0, 0),
-                       row(0, 0, 1, 0),
-                       row(0, 0, 1, 1),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) > (?, ?) and (c) <= (?) ", 0, 1, 0, 0, 1),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c, 
d) >= (?, ?) and (c, d) < (?, ?)", 0, 1, 0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) = (?, 
?) and d = ?", 0, 0, 1, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) IN 
((?, ?), (?, ?)) and d = ?", 0, 0, 1, 0, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c) 
= (?) and d = ?", 0, 0, 1, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) = (?, 
?) and d IN (?, ?)", 0, 0, 1, 0, 2),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and b = ? and (c) 
= (?) and d IN (?, ?)", 0, 0, 1, 0, 2),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) = (?, 
?) and d >= ?", 0, 0, 1, 0),
-                       row(0, 0, 1, 0),
-                       row(0, 0, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and d < 1 and (b, 
c) = (?, ?) and d >= ?", 0, 0, 1, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and d < 1 and (b, 
c) IN ((?, ?), (?, ?)) and d >= ?", 0, 0, 1, 0, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 0));
-        }
-    }
-
-    @Test
-    public void testSeveralMultiColumnRelation() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY 
KEY (a, b, c, d))" + compactOption);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 1);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 1);
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) = (?, ?)", 0, 1, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) IN ((?), 
(?)) and (c, d) = (?, ?)", 0, 0, 1, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c) IN ((?))", 0, 1, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) IN 
((?),(?)) and (c) IN ((?))", 0, 0, 1, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c) IN ((?), (?))", 0, 1, 0, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) IN ((?, ?))", 0, 1, 0, 0),
-                       row(0, 1, 0, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) IN ((?, ?), (?, ?))", 0, 1, 0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) IN ((?), 
(?)) and (c, d) IN ((?, ?), (?, ?))", 0, 0, 1, 0, 0, 1, 1),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) > (?, ?)", 0, 1, 0, 0),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) IN 
((?),(?)) and (c, d) > (?, ?)", 0, 0, 1, 0, 0),
-                       row(0, 0, 1, 0),
-                       row(0, 0, 1, 1),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) > (?, ?) and (c) <= (?) ", 0, 1, 0, 0, 1),
-                       row(0, 1, 1, 0),
-                       row(0, 1, 1, 1));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) = (?) and 
(c, d) >= (?, ?) and (c, d) < (?, ?)", 0, 1, 0, 0, 1, 1),
-                       row(0, 1, 0, 0),
-                       row(0, 1, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) = (?, 
?) and d = ?", 0, 0, 1, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) IN 
((?, ?), (?, ?)) and d = ?", 0, 0, 1, 0, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (d) < (1) and 
(b, c) = (?, ?) and (d) >= (?)", 0, 0, 1, 0),
-                       row(0, 0, 1, 0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (d) < (1) and 
(b, c) IN ((?, ?), (?, ?)) and (d) >= (?)", 0, 0, 1, 0, 0, 0),
-                       row(0, 0, 0, 0),
-                       row(0, 0, 1, 0));
-        }
-    }
-
-    @Test
-    public void testSinglePartitionInvalidQueries() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int PRIMARY KEY, b int)" + 
compactOption);
-            assertInvalidMessage("Multi-column relations can only be applied 
to clustering columns but was applied to: a",
-                                 "SELECT * FROM %s WHERE (a) > (?)", 0);
-            assertInvalidMessage("Multi-column relations can only be applied 
to clustering columns but was applied to: a",
-                                 "SELECT * FROM %s WHERE (a) = (?)", 0);
-            assertInvalidMessage("Multi-column relations can only be applied 
to clustering columns but was applied to: b",
-                                 "SELECT * FROM %s WHERE (b) = (?)", 0);
-        }
-    }
-
-    @Test
-    public void testSingleClustering() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, 
b))" + compactOption);
-
-            execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 0, 0);
-            execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 1, 0);
-            execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 2, 0);
-
-            // Equalities
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) = (?)", 
0, 1),
-                    row(0, 1, 0)
-            );
-
-            // Same but check the whole tuple can be prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) = ?", 0, 
tuple(1)),
-                    row(0, 1, 0)
-            );
-
-            assertEmpty(execute("SELECT * FROM %s WHERE a = ? AND (b) = (?)", 
0, 3));
-
-            // Inequalities
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) > (?)", 
0, 0),
-                    row(0, 1, 0),
-                    row(0, 2, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) >= (?)", 
0, 1),
-                    row(0, 1, 0),
-                    row(0, 2, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) < (?)", 
0, 2),
-                    row(0, 0, 0),
-                    row(0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) <= (?)", 
0, 1),
-                    row(0, 0, 0),
-                    row(0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) > (?) AND 
(b) < (?)", 0, 0, 2),
-                    row(0, 1, 0)
-            );
-        }
-    }
-
-    @Test
-    public void testNonEqualsRelation() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int PRIMARY KEY, b int)" + 
compactOption);
-            assertInvalidMessage("Unsupported \"!=\" relation: (b) != (0)",
-                    "SELECT * FROM %s WHERE a = 0 AND (b) != (0)");
-        }
-    }
-
-    @Test
-    public void testMultipleClustering() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " WITH COMPACT STORAGE"})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY 
KEY (a, b, c, d))" + compactOption);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 1);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 1);
-
-            // Empty query
-            assertEmpty(execute("SELECT * FROM %s WHERE a = 0 AND (b, c, d) IN 
()"));
-
-            // Equalities
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) = (?)", 
0, 1),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            // Same with whole tuple prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) = ?", 0, 
tuple(1)),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) = (?, 
?)", 0, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            // Same with whole tuple prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) = ?", 
0, tuple(1, 1)),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) = 
(?, ?, ?)", 0, 1, 1, 1),
-                    row(0, 1, 1, 1)
-            );
-
-            // Same with whole tuple prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) = 
?", 0, tuple(1, 1, 1)),
-                    row(0, 1, 1, 1)
-            );
-
-            // Inequalities
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) > (?)", 
0, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) >= (?)", 
0, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) > (?, 
?)", 0, 1, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) >= (?, 
?)", 0, 1, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?)", 0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) >= 
(?, ?, ?)", 0, 1, 1, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) < (?)", 
0, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) <= (?)", 
0, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) < (?, 
?)", 0, 0, 1),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) <= (?, 
?)", 0, 0, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) < 
(?, ?, ?)", 0, 0, 1, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) <= 
(?, ?, ?)", 0, 0, 1, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b) < (?)", 0, 0, 1, 0, 1),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b, c) < (?, ?)", 0, 0, 1, 1, 1, 1),
-                    row(0, 1, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b, c, d) < (?, ?, ?)", 0, 0, 1, 1, 1, 1, 0),
-                    row(0, 1, 0, 0)
-            );
-
-            // Same with whole tuple prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > ? 
AND (b, c, d) < ?", 0, tuple(0, 1, 1), tuple(1, 1, 0)),
-                    row(0, 1, 0, 0)
-            );
-
-            // reversed
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) > (?) 
ORDER BY b DESC, c DESC, d DESC", 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) >= (?) 
ORDER BY b DESC, c DESC, d DESC", 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) > (?, 
?) ORDER BY b DESC, c DESC, d DESC", 0, 1, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) >= (?, 
?) ORDER BY b DESC, c DESC, d DESC", 0, 1, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 1, 1, 0),
-                    row(0, 1, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) >= 
(?, ?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 1, 1, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) < (?) 
ORDER BY b DESC, c DESC, d DESC", 0, 1),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) <= (?) 
ORDER BY b DESC, c DESC, d DESC", 0, 1),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) < (?, 
?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) <= (?, 
?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) < 
(?, ?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) <= 
(?, ?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1, 1),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b) < (?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1, 0, 1),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b, c) < (?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1, 1, 1, 
1),
-                    row(0, 1, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) > 
(?, ?, ?) AND (b, c, d) < (?, ?, ?) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1, 
1, 1, 1, 0),
-                    row(0, 1, 0, 0)
-            );
-
-            // IN
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) IN 
((?, ?, ?), (?, ?, ?))", 0, 0, 1, 0, 0, 1, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            // same query but with whole tuple prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) IN 
(?, ?)", 0, tuple(0, 1, 0), tuple(0, 1, 1)),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            // same query but with whole IN list prepared
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) IN 
?", 0, list(tuple(0, 1, 0), tuple(0, 1, 1))),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            // same query, but reversed order for the IN values
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) IN 
(?, ?)", 0, tuple(0, 1, 1), tuple(0, 1, 0)),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b, c) IN 
((?, ?))", 0, 0, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? and (b) IN 
((?))", 0, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1)
-            );
-
-            assertEmpty(execute("SELECT * FROM %s WHERE a = ? and (b) IN ()", 
0));
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) IN 
((?, ?)) ORDER BY b DESC, c DESC, d DESC", 0, 0, 1),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertEmpty(execute("SELECT * FROM %s WHERE a = ? AND (b, c) IN () 
ORDER BY b DESC, c DESC, d DESC", 0));
-
-            // IN on both partition key and clustering key
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 0, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 0, 
1, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 0, 
1, 1);
-
-            assertRows(execute("SELECT * FROM %s WHERE a IN (?, ?) AND (b, c, 
d) IN (?, ?)", 0, 1, tuple(0, 1, 0), tuple(0, 1, 1)),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(1, 0, 1, 0),
-                    row(1, 0, 1, 1)
-            );
-
-            // same but with whole IN lists prepared
-            assertRows(execute("SELECT * FROM %s WHERE a IN ? AND (b, c, d) IN 
?", list(0, 1), list(tuple(0, 1, 0), tuple(0, 1, 1))),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(1, 0, 1, 0),
-                    row(1, 0, 1, 1)
-            );
-
-            // same query, but reversed order for the IN values
-            assertRows(execute("SELECT * FROM %s WHERE a IN (?, ?) AND (b, c, 
d) IN (?, ?)", 1, 0, tuple(0, 1, 1), tuple(0, 1, 0)),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(1, 0, 1, 0),
-                    row(1, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a IN (?, ?) and (b, c) 
IN ((?, ?))", 0, 1, 0, 1),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(1, 0, 1, 0),
-                    row(1, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a IN (?, ?) and (b) IN 
((?))", 0, 1, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 0),
-                    row(0, 0, 1, 1),
-                    row(1, 0, 0, 0),
-                    row(1, 0, 1, 0),
-                    row(1, 0, 1, 1)
-            );
-        }
-    }
-
-    @Test
-    public void testMultipleClusteringReversedComponents() throws Throwable
-    {
-        for (String compactOption : new String[]{"", " COMPACT STORAGE AND"})
-        {
-            createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY 
KEY (a, b, c, d)) WITH" + compactOption + " CLUSTERING ORDER BY (b DESC, c ASC, 
d DESC)");
-
-            // b and d are reversed in the clustering order
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 1);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 1, 
1, 0);
-
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
0, 0);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 1);
-            execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 0, 0, 
1, 0);
-
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) > (?)", 
0, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) >= (?)", 
0, 0),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) < (?)", 
0, 1),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) <= (?)", 
0, 1),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a=? AND (b, c, d) IN 
((?, ?, ?), (?, ?, ?))", 0, 1, 1, 1, 0, 1, 1),
-                    row(0, 1, 1, 1),
-                    row(0, 0, 1, 1)
-            );
-
-            // same query, but reversed order for the IN values
-            assertRows(execute("SELECT * FROM %s WHERE a=? AND (b, c, d) IN 
((?, ?, ?), (?, ?, ?))", 0, 0, 1, 1, 1, 1, 1),
-                    row(0, 1, 1, 1),
-                    row(0, 0, 1, 1)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c, d) IN 
(?, ?, ?, ?, ?, ?)",
-                            0, tuple(1, 0, 0), tuple(1, 1, 1), tuple(1, 1, 0), 
tuple(0, 0, 0), tuple(0, 1, 1), tuple(0, 1, 0)),
-                    row(0, 1, 0, 0),
-                    row(0, 1, 1, 1),
-                    row(0, 1, 1, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) IN 
(?)", 0, tuple(0, 1)),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b, c) IN 
(?)", 0, tuple(0, 0)),
-                    row(0, 0, 0, 0)
-            );
-
-            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b) IN 
((?))", 0, 0),
-                    row(0, 0, 0, 0),
-                    row(0, 0, 1, 1),
-                    row(0, 0, 1, 0)
-            );
-
-            // preserve pre-6875 behavior (even though the query result is 
technically incorrect)
-            assertEmpty(execute("SELECT * FROM %s WHERE a = ? AND (b, c) > (?, 
?)", 0, 1, 0));
-        }
-    }
-
-    @Test
-    public void testMultipleClusteringWithIndex() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, 
PRIMARY KEY (a, b, c, d))");
-        createIndex("CREATE INDEX ON %s (b)");
-        createIndex("CREATE INDEX ON %s (e)");
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 
0, 0, 0);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 
1, 0, 1);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 0, 
1, 1, 2);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 
0, 0, 0);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 
1, 0, 1);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 1, 
1, 1, 2);
-        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 2, 
0, 0, 0);
-        assertRows(execute("SELECT * FROM %s WHERE (b) = (?)", 1),
-                   row(0, 1, 0, 0, 0),
-                   row(0, 1, 1, 0, 1),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b, c) = (?, ?)", 1, 1);
-        assertRows(execute("SELECT * FROM %s WHERE (b, c) = (?, ?) ALLOW 
FILTERING", 1, 1),
-                   row(0, 1, 1, 0, 1),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b, c) = (?, ?) AND e = 
?", 1, 1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b, c) = (?, ?) AND e = ? 
ALLOW FILTERING", 1, 1, 2),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b) IN ((?)) AND e = ?", 
1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b) IN ((?)) AND e = ? 
ALLOW FILTERING", 1, 2),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b) IN ((?), (?)) AND e = 
?", 0, 1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b) IN ((?), (?)) AND e = ? 
ALLOW FILTERING", 0, 1, 2),
-                   row(0, 0, 1, 1, 2),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b, c) IN ((?, ?)) AND e 
= ?", 0, 1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b, c) IN ((?, ?)) AND e = 
? ALLOW FILTERING", 0, 1, 2),
-                   row(0, 0, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b, c) IN ((?, ?), (?, 
?)) AND e = ?", 0, 1, 1, 1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b, c) IN ((?, ?), (?, ?)) 
AND e = ? ALLOW FILTERING", 0, 1, 1, 1, 2),
-                   row(0, 0, 1, 1, 2),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b) >= (?) AND e = ?", 1, 
2);
-        assertRows(execute("SELECT * FROM %s WHERE (b) >= (?) AND e = ? ALLOW 
FILTERING", 1, 2),
-                   row(0, 1, 1, 1, 2));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE (b, c) >= (?, ?) AND e = 
?", 1, 1, 2);
-        assertRows(execute("SELECT * FROM %s WHERE (b, c) >= (?, ?) AND e = ? 
ALLOW FILTERING", 1, 1, 2),
-                   row(0, 1, 1, 1, 2));
-    }
-
-    @Test
-    public void testMultiplePartitionKeyAndMultiClusteringWithIndex() throws 
Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, f 
int, PRIMARY KEY ((a, b), c, d, e))");
-        createIndex("CREATE INDEX ON %s (c)");
-        createIndex("CREATE INDEX ON %s (f)");
-
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 0, 0, 0, 0);
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 0, 1, 0, 1);
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 0, 1, 1, 2);
-
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 1, 0, 0, 3);
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 1, 1, 0, 4);
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 1, 1, 1, 5);
-
-        execute("INSERT INTO %s (a, b, c, d, e, f) VALUES (?, ?, ?, ?, ?, ?)", 
0, 0, 2, 0, 0, 5);
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c) = (?)");
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) = (?) ALLOW 
FILTERING", 0, 1),
-                   row(0, 0, 1, 0, 0, 3),
-                   row(0, 0, 1, 1, 0, 4),
-                   row(0, 0, 1, 1, 1, 5));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c, d) = (?, 
?)", 0, 1, 1);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c, d) = (?, ?) 
ALLOW FILTERING", 0, 1, 1),
-                   row(0, 0, 1, 1, 0, 4),
-                   row(0, 0, 1, 1, 1, 5));
-
-        assertInvalidMessage("Partition key parts: b must be restricted as 
other parts are",
-                             "SELECT * FROM %s WHERE a = ? AND (c, d) IN ((?, 
?)) ALLOW FILTERING", 0, 1, 1);
-
-        assertInvalidMessage("Partition key parts: b must be restricted as 
other parts are",
-                             "SELECT * FROM %s WHERE a = ? AND (c, d) >= (?, 
?) ALLOW FILTERING", 0, 1, 1);
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c) IN ((?)) 
AND f = ?", 0, 1, 5);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) IN ((?)) AND 
f = ? ALLOW FILTERING", 0, 1, 5),
-                   row(0, 0, 1, 1, 1, 5));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c) IN ((?), 
(?)) AND f = ?", 0, 1, 2, 5);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) IN ((?), (?)) 
AND f = ? ALLOW FILTERING", 0, 1, 2, 5),
-                   row(0, 0, 1, 1, 1, 5),
-                   row(0, 0, 2, 0, 0, 5));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c, d) IN ((?, 
?)) AND f = ?", 0, 1, 0, 3);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c, d) IN ((?, 
?)) AND f = ? ALLOW FILTERING", 0, 1, 0, 3),
-                   row(0, 0, 1, 0, 0, 3));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c) >= (?) AND 
f = ?", 0, 1, 5);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c) >= (?) AND f 
= ? ALLOW FILTERING", 0, 1, 5),
-                   row(0, 0, 1, 1, 1, 5),
-                   row(0, 0, 2, 0, 0, 5));
-
-        assertInvalidMessage("Cannot execute this query as it might involve 
data filtering",
-                             "SELECT * FROM %s WHERE a = ? AND (c, d) >= (?, 
?) AND f = ?", 0, 1, 1, 5);
-        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (c, d) >= (?, ?) 
AND f = ? ALLOW FILTERING", 0, 1, 1, 5),
-                   row(0, 0, 1, 1, 1, 5),
-                   row(0, 0, 2, 0, 0, 5));
-    }
-
-    @Test
-    public void testINWithDuplicateValue() throws Throwable
-    {
-        for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" 
})
-        {
-            createTable("CREATE TABLE %s (k1 int, k2 int, v int, PRIMARY KEY 
(k1, k2))" + compactOption);
-            execute("INSERT INTO %s (k1,  k2, v) VALUES (?, ?, ?)", 1, 1, 1);
-
-            assertRows(execute("SELECT * FROM %s WHERE k1 IN (?, ?) AND (k2) 
IN ((?), (?))", 1, 1, 1, 2),
-                       row(1, 1, 1));
-            assertRows(execute("SELECT * FROM %s WHERE k1 = ? AND (k2) IN 
((?), (?))", 1, 1, 1),
-                       row(1, 1, 1));
-        }
-    }
-
-    @Test
-    public void testWithUnsetValues() throws Throwable
-    {
-        createTable("CREATE TABLE %s (k int, i int, j int, s text, PRIMARY 
KEY(k,i,j))");
-        createIndex("CREATE INDEX s_index ON %s (s)");
-
-        assertInvalidMessage("Invalid unset value for tuple field number 0",
-                             "SELECT * from %s WHERE (i, j) = (?,?) ALLOW 
FILTERING", unset(), 1);
-        assertInvalidMessage("Invalid unset value for tuple field number 0",
-                             "SELECT * from %s WHERE (i, j) IN ((?,?)) ALLOW 
FILTERING", unset(), 1);
-        assertInvalidMessage("Invalid unset value for tuple field number 1",
-                             "SELECT * from %s WHERE (i, j) > (1,?) ALLOW 
FILTERING", unset());
-        assertInvalidMessage("Invalid unset value for tuple (i,j)",
-                             "SELECT * from %s WHERE (i, j) = ? ALLOW 
FILTERING", unset());
-        assertInvalidMessage("Invalid unset value for tuple (j)",
-                             "SELECT * from %s WHERE i = ? AND (j) > ? ALLOW 
FILTERING", 1, unset());
-        assertInvalidMessage("Invalid unset value for tuple (i,j)",
-                             "SELECT * from %s WHERE (i, j) IN (?, ?) ALLOW 
FILTERING", unset(), tuple(1, 1));
-        assertInvalidMessage("Invalid unset value for in(i,j)",
-                             "SELECT * from %s WHERE (i, j) IN ? ALLOW 
FILTERING", unset());
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/PgStringTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/PgStringTest.java 
b/test/unit/org/apache/cassandra/cql3/PgStringTest.java
deleted file mode 100644
index 0a9d702..0000000
--- a/test/unit/org/apache/cassandra/cql3/PgStringTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.junit.Test;
-
-import org.apache.cassandra.exceptions.SyntaxException;
-
-public class PgStringTest extends CQLTester
-{
-    @Test
-    public void testPgSyleFunction() throws Throwable
-    {
-        execute("create or replace function "+KEYSPACE+".pgfun1 ( input double 
) called on null input returns text language java\n" +
-                "AS $$return \"foobar\";$$");
-    }
-
-    @Test
-    public void testPgSyleInsert() throws Throwable
-    {
-        createTable("CREATE TABLE %s (key ascii primary key, val text)");
-
-        // some non-terminated pg-strings
-        assertInvalidSyntax("INSERT INTO %s (key, val) VALUES ($ $key_empty$$, 
$$'' value for empty$$)");
-        assertInvalidSyntax("INSERT INTO %s (key, val) VALUES ($$key_empty$$, 
$$'' value for empty$ $)");
-        assertInvalidSyntax("INSERT INTO %s (key, val) VALUES ($$key_empty$ $, 
$$'' value for empty$$)");
-
-        // different pg-style markers for multiple strings
-        execute("INSERT INTO %s (key, val) VALUES ($$prim$ $ $key$$, $$some '' 
arbitrary value$$)");
-        // same empty pg-style marker for multiple strings
-        execute("INSERT INTO %s (key, val) VALUES ($$key_empty$$, $$'' value 
for empty$$)");
-        // stange but valid pg-style
-        execute("INSERT INTO %s (key, val) VALUES ($$$foo$_$foo$$, $$$'' value 
for empty$$)");
-        // these are conventional quoted strings
-        execute("INSERT INTO %s (key, val) VALUES ('$txt$key$$$$txt$', 
'$txt$'' other value$txt$')");
-
-        assertRows(execute("SELECT key, val FROM %s WHERE key='prim$ $ $key'"),
-                   row("prim$ $ $key", "some '' arbitrary value")
-        );
-        assertRows(execute("SELECT key, val FROM %s WHERE key='key_empty'"),
-                   row("key_empty", "'' value for empty")
-        );
-        assertRows(execute("SELECT key, val FROM %s WHERE key='$foo$_$foo'"),
-                   row("$foo$_$foo", "$'' value for empty")
-        );
-        assertRows(execute("SELECT key, val FROM %s WHERE 
key='$txt$key$$$$txt$'"),
-                   row("$txt$key$$$$txt$", "$txt$' other value$txt$")
-        );
-
-        // invalid syntax
-        assertInvalidSyntax("INSERT INTO %s (key, val) VALUES 
($ascii$prim$$$key$invterm$, $txt$some '' arbitrary value$txt$)");
-    }
-
-    @Test(expected = SyntaxException.class)
-    public void testMarkerPgFail() throws Throwable
-    {
-        // must throw SyntaxException - not StringIndexOutOfBoundsException or 
similar
-        execute("create function "+KEYSPACE+".pgfun1 ( input double ) called 
on null input returns bigint language java\n" +
-                "AS $javasrc$return 0L;$javasrc$;");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/RangeDeletionTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/RangeDeletionTest.java 
b/test/unit/org/apache/cassandra/cql3/RangeDeletionTest.java
deleted file mode 100644
index b31d0c2..0000000
--- a/test/unit/org/apache/cassandra/cql3/RangeDeletionTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.junit.Test;
-
-public class RangeDeletionTest extends CQLTester
-{
-    @Test
-    public void testCassandra8558() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c int, d int, PRIMARY KEY 
(a, b, c))");
-
-        execute("INSERT INTO %s (a, b, c, d) VALUES (?, ?, ?, ?)", 1, 1, 1, 1);
-        flush();
-        execute("DELETE FROM %s WHERE a=? AND b=?", 1, 1);
-        flush();
-        assertEmpty(execute("SELECT * FROM %s WHERE a=? AND b=? AND c=?", 1, 
1, 1));
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/RoleSyntaxTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/cql3/RoleSyntaxTest.java 
b/test/unit/org/apache/cassandra/cql3/RoleSyntaxTest.java
deleted file mode 100644
index 02bfe61..0000000
--- a/test/unit/org/apache/cassandra/cql3/RoleSyntaxTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.junit.Test;
-
-public class RoleSyntaxTest extends CQLTester
-{
-    @Test
-    public void standardOptionsSyntaxTest() throws Throwable
-    {
-        assertValidSyntax("CREATE ROLE r WITH LOGIN = true AND SUPERUSER = 
false AND PASSWORD = 'foo'");
-        assertValidSyntax("CREATE ROLE r WITH PASSWORD = 'foo' AND LOGIN = 
true AND SUPERUSER = false");
-        assertValidSyntax("CREATE ROLE r WITH SUPERUSER = true AND PASSWORD = 
'foo' AND LOGIN = false");
-        assertValidSyntax("CREATE ROLE r WITH LOGIN = true AND PASSWORD = 
'foo' AND SUPERUSER = false");
-        assertValidSyntax("CREATE ROLE r WITH SUPERUSER = true AND PASSWORD = 
'foo' AND LOGIN = false");
-
-        assertValidSyntax("ALTER ROLE r WITH LOGIN = true AND SUPERUSER = 
false AND PASSWORD = 'foo'");
-        assertValidSyntax("ALTER ROLE r WITH PASSWORD = 'foo' AND LOGIN = true 
AND SUPERUSER = false");
-        assertValidSyntax("ALTER ROLE r WITH SUPERUSER = true AND PASSWORD = 
'foo' AND LOGIN = false");
-        assertValidSyntax("ALTER ROLE r WITH LOGIN = true AND PASSWORD = 'foo' 
AND SUPERUSER = false");
-        assertValidSyntax("ALTER ROLE r WITH SUPERUSER = true AND PASSWORD = 
'foo' AND LOGIN = false");
-    }
-
-    @Test
-    public void customOptionsSyntaxTestl() throws Throwable
-    {
-        assertValidSyntax("CREATE ROLE r WITH OPTIONS = {'a':'b', 'b':1}");
-        assertInvalidSyntax("CREATE ROLE r WITH OPTIONS = 'term'");
-        assertInvalidSyntax("CREATE ROLE r WITH OPTIONS = 99");
-
-        assertValidSyntax("ALTER ROLE r WITH OPTIONS = {'a':'b', 'b':1}");
-        assertInvalidSyntax("ALTER ROLE r WITH OPTIONS = 'term'");
-        assertInvalidSyntax("ALTER ROLE r WITH OPTIONS = 99");
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/SSTableMetadataTrackingTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/SSTableMetadataTrackingTest.java 
b/test/unit/org/apache/cassandra/cql3/SSTableMetadataTrackingTest.java
deleted file mode 100644
index 7c3965f..0000000
--- a/test/unit/org/apache/cassandra/cql3/SSTableMetadataTrackingTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.junit.Test;
-
-import org.apache.cassandra.db.ColumnFamilyStore;
-import org.apache.cassandra.db.Keyspace;
-import org.apache.cassandra.io.sstable.metadata.StatsMetadata;
-import static org.junit.Assert.assertEquals;
-
-public class SSTableMetadataTrackingTest extends CQLTester
-{
-    @Test
-    public void baseCheck() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, 
b))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("INSERT INTO %s (a,b,c) VALUES (1,1,'1') using timestamp 
9999");
-        cfs.forceBlockingFlush();
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
-        cfs.forceMajorCompaction();
-        metadata = cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
-    }
-
-    @Test
-    public void testMinMaxtimestampRange() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, 
b))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("INSERT INTO %s (a,b,c) VALUES (1,1,'1') using timestamp 
10000");
-        execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1 and b = 1");
-        cfs.forceBlockingFlush();
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(10000, metadata.maxTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
-        cfs.forceMajorCompaction();
-        metadata = cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(10000, metadata.maxTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
-    }
-
-    @Test
-    public void testMinMaxtimestampRow() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, 
b))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("INSERT INTO %s (a,b,c) VALUES (1,1,'1') using timestamp 
10000");
-        execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1");
-        cfs.forceBlockingFlush();
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(10000, metadata.maxTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
-        cfs.forceMajorCompaction();
-        metadata = cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(10000, metadata.maxTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime, 5);
-    }
-
-
-    @Test
-    public void testTrackMetadata_rangeTombstone() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, 
b)) WITH gc_grace_seconds = 10000");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1 and b = 1");
-        cfs.forceBlockingFlush();
-        assertEquals(1, cfs.getSSTables().size());
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(9999, metadata.maxTimestamp);
-        assertEquals(System.currentTimeMillis()/1000, 
metadata.maxLocalDeletionTime, 5);
-        cfs.forceMajorCompaction();
-        StatsMetadata metadata2 = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(metadata.maxLocalDeletionTime, 
metadata2.maxLocalDeletionTime);
-        assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
-        assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
-    }
-
-    @Test
-    public void testTrackMetadata_rowTombstone() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, b int, c text, PRIMARY KEY (a, 
b))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a = 1");
-
-        cfs.forceBlockingFlush();
-        assertEquals(1, cfs.getSSTables().size());
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(9999, metadata.maxTimestamp);
-        assertEquals(System.currentTimeMillis()/1000, 
metadata.maxLocalDeletionTime, 5);
-        cfs.forceMajorCompaction();
-        StatsMetadata metadata2 = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(metadata.maxLocalDeletionTime, 
metadata2.maxLocalDeletionTime);
-        assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
-        assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
-    }
-
-    @Test
-    public void testTrackMetadata_rowMarker() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, PRIMARY KEY (a))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("INSERT INTO %s (a) VALUES (1) USING TIMESTAMP 9999");
-
-        cfs.forceBlockingFlush();
-        assertEquals(1, cfs.getSSTables().size());
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(9999, metadata.maxTimestamp);
-        assertEquals(Integer.MAX_VALUE, metadata.maxLocalDeletionTime);
-        cfs.forceMajorCompaction();
-        StatsMetadata metadata2 = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(metadata.maxLocalDeletionTime, 
metadata2.maxLocalDeletionTime);
-        assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
-        assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
-    }
-    @Test
-    public void testTrackMetadata_rowMarkerDelete() throws Throwable
-    {
-        createTable("CREATE TABLE %s (a int, PRIMARY KEY (a))");
-        ColumnFamilyStore cfs = 
Keyspace.open(keyspace()).getColumnFamilyStore(currentTable());
-        execute("DELETE FROM %s USING TIMESTAMP 9999 WHERE a=1");
-        cfs.forceBlockingFlush();
-        assertEquals(1, cfs.getSSTables().size());
-        StatsMetadata metadata = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(9999, metadata.minTimestamp);
-        assertEquals(9999, metadata.maxTimestamp);
-        assertEquals(System.currentTimeMillis()/1000, 
metadata.maxLocalDeletionTime, 5);
-        cfs.forceMajorCompaction();
-        StatsMetadata metadata2 = 
cfs.getSSTables().iterator().next().getSSTableMetadata();
-        assertEquals(metadata.maxLocalDeletionTime, 
metadata2.maxLocalDeletionTime);
-        assertEquals(metadata.minTimestamp, metadata2.minTimestamp);
-        assertEquals(metadata.maxTimestamp, metadata2.maxTimestamp);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/01115f72/test/unit/org/apache/cassandra/cql3/SecondaryIndexOnMapEntriesTest.java
----------------------------------------------------------------------
diff --git 
a/test/unit/org/apache/cassandra/cql3/SecondaryIndexOnMapEntriesTest.java 
b/test/unit/org/apache/cassandra/cql3/SecondaryIndexOnMapEntriesTest.java
deleted file mode 100644
index e502f6a..0000000
--- a/test/unit/org/apache/cassandra/cql3/SecondaryIndexOnMapEntriesTest.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.cql3;
-
-import org.apache.cassandra.exceptions.InvalidRequestException;
-import org.apache.commons.lang3.StringUtils;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class SecondaryIndexOnMapEntriesTest extends CQLTester
-{
-    @Test
-    public void testShouldNotCreateIndexOnFrozenMaps() throws Throwable
-    {
-        createTable("CREATE TABLE %s (k TEXT PRIMARY KEY, v FROZEN<MAP<TEXT, 
TEXT>>)");
-        assertIndexInvalidForColumn("v");
-    }
-
-    @Test
-    public void testShouldNotCreateIndexOnNonMapTypes() throws Throwable
-    {
-        createTable("CREATE TABLE %s (k TEXT PRIMARY KEY, i INT, t TEXT, b 
BLOB, s SET<TEXT>, l LIST<TEXT>, tu TUPLE<TEXT>)");
-        assertIndexInvalidForColumn("i");
-        assertIndexInvalidForColumn("t");
-        assertIndexInvalidForColumn("b");
-        assertIndexInvalidForColumn("s");
-        assertIndexInvalidForColumn("l");
-        assertIndexInvalidForColumn("tu");
-    }
-
-    @Test
-    public void testShouldValidateMapKeyAndValueTypes() throws Throwable
-    {
-        createSimpleTableAndIndex();
-
-        String query = "SELECT * FROM %s WHERE v[?] = ?";
-        Object validKey = "valid key";
-        Object invalidKey = 31415;
-        Object validValue = 31415;
-        Object invalidValue = "invalid value";
-        assertInvalid(query, invalidKey, invalidValue);
-        assertInvalid(query, invalidKey, validValue);
-        assertInvalid(query, validKey, invalidValue);
-        assertReturnsNoRows(query, validKey, validValue);
-    }
-
-    @Test
-    public void testShouldFindRowsMatchingSingleEqualityRestriction() throws 
Throwable
-    {
-        createSimpleTableAndIndex();
-        Object[] foo = insertIntoSimpleTable("foo", map("a", 1,
-                                                        "c", 3));
-        Object[] bar = insertIntoSimpleTable("bar", map("a", 1,
-                                                        "b", 2));
-        Object[] baz = insertIntoSimpleTable("baz", map("b", 2,
-                                                        "c", 5,
-                                                        "d", 4));
-        Object[] qux = insertIntoSimpleTable("qux", map("b", 2,
-                                                        "d", 4));
-
-        assertRowsForConditions(entry("a", 1), bar, foo);
-        assertRowsForConditions(entry("b", 2), bar, baz, qux);
-        assertRowsForConditions(entry("c", 3), foo);
-        assertRowsForConditions(entry("c", 5), baz);
-        assertRowsForConditions(entry("d", 4), baz, qux);
-    }
-
-    @Test
-    public void testRequireFilteringDirectiveIfMultipleRestrictionsSpecified() 
throws Throwable
-    {
-        createSimpleTableAndIndex();
-        String baseQuery = "SELECT * FROM %s WHERE v['foo'] = 31415 AND 
v['baz'] = 31416";
-        assertInvalid(baseQuery);
-        assertReturnsNoRows(baseQuery + " ALLOW FILTERING");
-    }
-
-    @Test
-    public void testShouldFindRowsMatchingMultipleEqualityRestrictions() 
throws Throwable
-    {
-        createSimpleTableAndIndex();
-
-        Object[] foo = insertIntoSimpleTable("foo", map("k1", 1));
-        Object[] bar = insertIntoSimpleTable("bar", map("k1", 1,
-                                                        "k2", 2));
-        Object[] baz = insertIntoSimpleTable("baz", map("k2", 2,
-                                                        "k3", 3));
-        Object[] qux = insertIntoSimpleTable("qux", map("k2", 2,
-                                                        "k3", 3,
-                                                        "k4", 4));
-
-        assertRowsForConditions(entry("k1", 1),
-                                bar, foo);
-        assertRowsForConditions(entry("k1", 1).entry("k2", 2),
-                                bar);
-        assertNoRowsForConditions(entry("k1", 1).entry("k2", 2).entry("k3", 
3));
-        assertRowsForConditions(entry("k2", 2).entry("k3", 3),
-                                baz, qux);
-        assertRowsForConditions(entry("k2", 2).entry("k3", 3).entry("k4", 4),
-                                qux);
-        assertRowsForConditions(entry("k3", 3).entry("k4", 4),
-                                qux);
-        assertNoRowsForConditions(entry("k3", 3).entry("k4", 4).entry("k5", 
5));
-    }
-
-    @Test
-    public void testShouldFindRowsMatchingEqualityAndContainsRestrictions() 
throws Throwable
-    {
-        createSimpleTableAndIndex();
-
-        Object[] foo = insertIntoSimpleTable("foo", map("common", 31415,
-                                                        "k1", 1,
-                                                        "k2", 2,
-                                                        "k3", 3));
-        Object[] bar = insertIntoSimpleTable("bar", map("common", 31415,
-                                                        "k3", 3,
-                                                        "k4", 4,
-                                                        "k5", 5));
-        Object[] baz = insertIntoSimpleTable("baz", map("common", 31415,
-                                                        "k5", 5,
-                                                        "k6", 6,
-                                                        "k7", 7));
-
-        assertRowsForConditions(entry("common", 31415),
-                                bar, baz, foo);
-        assertRowsForConditions(entry("common", 31415).key("k1"),
-                                foo);
-        assertRowsForConditions(entry("common", 31415).key("k2"),
-                                foo);
-        assertRowsForConditions(entry("common", 31415).key("k3"),
-                                bar, foo);
-        assertRowsForConditions(entry("common", 31415).key("k3").value(2),
-                                foo);
-        assertRowsForConditions(entry("common", 31415).key("k3").value(3),
-                                bar, foo);
-        assertRowsForConditions(entry("common", 31415).key("k3").value(4),
-                                bar);
-        assertRowsForConditions(entry("common", 31415).key("k3").key("k5"),
-                                bar);
-        assertRowsForConditions(entry("common", 31415).key("k5"),
-                                bar, baz);
-        assertRowsForConditions(entry("common", 31415).key("k5").value(4),
-                                bar);
-        assertRowsForConditions(entry("common", 31415).key("k5").value(5),
-                                bar, baz);
-        assertRowsForConditions(entry("common", 31415).key("k5").value(6),
-                                baz);
-        assertNoRowsForConditions(entry("common", 31415).key("k5").value(8));
-    }
-
-    @Test
-    public void testShouldNotAcceptUnsupportedRelationsOnEntries() throws 
Throwable
-    {
-        createSimpleTableAndIndex();
-        assertInvalidRelation("< 31415");
-        assertInvalidRelation("<= 31415");
-        assertInvalidRelation("> 31415");
-        assertInvalidRelation(">= 31415");
-        assertInvalidRelation("IN (31415, 31416, 31417)");
-        assertInvalidRelation("CONTAINS 31415");
-        assertInvalidRelation("CONTAINS KEY 'foo'");
-    }
-
-    @Test
-    public void testShouldRecognizeAlteredOrDeletedMapEntries() throws 
Throwable
-    {
-        createSimpleTableAndIndex();
-        Object[] foo = insertIntoSimpleTable("foo", map("common", 31415,
-                                                        "target", 8192));
-        Object[] bar = insertIntoSimpleTable("bar", map("common", 31415,
-                                                        "target", 8192));
-        Object[] baz = insertIntoSimpleTable("baz", map("common", 31415,
-                                                        "target", 8192));
-
-        assertRowsForConditions(entry("target", 8192),
-                                bar, baz, foo);
-        baz = updateMapInSimpleTable(baz, "target", 4096);
-        assertRowsForConditions(entry("target", 8192),
-                                bar, foo);
-        bar = updateMapInSimpleTable(bar, "target", null);
-        assertRowsForConditions(entry("target", 8192),
-                                foo);
-        execute("DELETE FROM %s WHERE k = 'foo'");
-        assertNoRowsForConditions(entry("target", 8192));
-        assertRowsForConditions(entry("common", 31415),
-                                bar, baz);
-        assertRowsForConditions(entry("target", 4096),
-                                baz);
-    }
-
-    @Test
-    public void testShouldRejectQueriesForNullEntries() throws Throwable
-    {
-        createSimpleTableAndIndex();
-        assertInvalid("SELECT * FROM %s WHERE v['somekey'] = null");
-    }
-
-    @Test
-    public void testShouldTreatQueriesAgainstFrozenMapIndexesAsInvalid() 
throws Throwable
-    {
-        createTable("CREATE TABLE %s (k TEXT PRIMARY KEY, v FROZEN<MAP<TEXT, 
TEXT>>)");
-        createIndex("CREATE INDEX ON %s(FULL(V))");
-
-        try
-        {
-            execute("SELECT * FROM %s WHERE v['somekey'] = 'somevalue'");
-            fail("Expected index query to fail");
-        }
-        catch (InvalidRequestException e)
-        {
-            String expectedMessage = "Map-entry equality predicates on frozen 
map column v are not supported";
-            assertTrue("Expected error message to contain '" + expectedMessage 
+ "' but got '" +
-                       e.getMessage() + "'", 
e.getMessage().contains(expectedMessage));
-        }
-    }
-
-    private void assertIndexInvalidForColumn(String colname) throws Throwable
-    {
-        String query = String.format("CREATE INDEX ON %%s(ENTRIES(%s))", 
colname);
-        assertInvalid(query);
-    }
-
-    private void assertReturnsNoRows(String query, Object... params) throws 
Throwable
-    {
-        assertRows(execute(query, params));
-    }
-
-    private void createSimpleTableAndIndex() throws Throwable
-    {
-        createTable("CREATE TABLE %s (k TEXT PRIMARY KEY, v MAP<TEXT, INT>)");
-        createIndex("CREATE INDEX ON %s(ENTRIES(v))");
-    }
-
-    private Object[] insertIntoSimpleTable(String key, Object value) throws 
Throwable
-    {
-        String query = "INSERT INTO %s (k, v) VALUES (?, ?)";
-        execute(query, key, value);
-        return row(key, value);
-    }
-
-    private void assertRowsForConditions(IndexWhereClause whereClause, 
Object[]... rows) throws Throwable
-    {
-        assertRows(execute("SELECT * FROM %s WHERE " + whereClause.text(), 
whereClause.params()), rows);
-    }
-
-    private void assertNoRowsForConditions(IndexWhereClause whereClause) 
throws Throwable
-    {
-        assertRowsForConditions(whereClause);
-    }
-
-    private void assertInvalidRelation(String rel) throws Throwable
-    {
-        String query = "SELECT * FROM %s WHERE v " + rel;
-        assertInvalid(query);
-    }
-
-    private Object[] updateMapInSimpleTable(Object[] row, String mapKey, 
Integer mapValue) throws Throwable
-    {
-        execute("UPDATE %s SET v[?] = ? WHERE k = ?", mapKey, mapValue, 
row[0]);
-        UntypedResultSet rawResults = execute("SELECT * FROM %s WHERE k = ?", 
row[0]);
-        Map<Object, Object> value = (Map<Object, Object>)row[1];
-        if (mapValue == null)
-        {
-            value.remove(mapKey);
-        }
-        else
-        {
-            value.put(mapKey, mapValue);
-        }
-        return row;
-    }
-
-    private IndexWhereClause entry(Object key, Object value)
-    {
-        return (new IndexWhereClause()).entry(key, value);
-    }
-
-    private static final class IndexWhereClause
-    {
-        private final List<String> preds = new ArrayList<>();
-        private final List<Object> params = new ArrayList<>();
-
-        public IndexWhereClause entry(Object key, Object value)
-        {
-            preds.add("v[?] = ?");
-            params.add(key);
-            params.add(value);
-            return this;
-        }
-
-        public IndexWhereClause key(Object key)
-        {
-            preds.add("v CONTAINS KEY ?");
-            params.add(key);
-            return this;
-        }
-
-        public IndexWhereClause value(Object value)
-        {
-            preds.add("v CONTAINS ?");
-            params.add(value);
-            return this;
-        }
-
-        public String text()
-        {
-            if (preds.size() == 1)
-                return preds.get(0);
-            return StringUtils.join(preds, " AND ") + " ALLOW FILTERING";
-        }
-
-        public Object[] params()
-        {
-            return params.toArray();
-        }
-    }
-}

Reply via email to