Merge branch 'cassandra-3.11' into trunk

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

Branch: refs/heads/trunk
Commit: 325d70d5a62e92c64aa5e0331e24390604a45d8f
Parents: 9944d9e 54be1fa
Author: Aleksey Yeshchenko <alek...@apple.com>
Authored: Tue Nov 20 15:25:38 2018 +0000
Committer: Aleksey Yeshchenko <alek...@apple.com>
Committed: Tue Nov 20 15:25:38 2018 +0000

----------------------------------------------------------------------
 .../SelectMultiColumnRelationTest.java          | 25 ++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/325d70d5/test/unit/org/apache/cassandra/cql3/validation/operations/SelectMultiColumnRelationTest.java
----------------------------------------------------------------------
diff --cc 
test/unit/org/apache/cassandra/cql3/validation/operations/SelectMultiColumnRelationTest.java
index 52a7f47,30c727b..5062448
--- 
a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectMultiColumnRelationTest.java
+++ 
b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectMultiColumnRelationTest.java
@@@ -1561,317 -1603,346 +1561,342 @@@ public class SelectMultiColumnRelationT
      @Test
      public void testMixedOrderColumns4() throws Throwable
      {
 -        for (String compactOption : new String[]{"", " COMPACT STORAGE AND "})
 -        {
 -            createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, 
PRIMARY KEY (a, b, c, d, e)) WITH " +
 -                        compactOption +
 -                        "CLUSTERING ORDER BY (b ASC, c DESC, d DESC, e ASC)");
 -
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 2, 0, -1, 0);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 2, 0, -1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 2, 0, 1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 2, -1, 1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 2, -3, 1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, -1, 0, 0);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, -1, 1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, -1, 1, 0);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, 0, 1, -1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, 0, 1, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, 0, 0, -1);
 -            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, 0, 0, 1);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, 1, 0, -1, -1);
 -            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, 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, 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, 0);
 -            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, -1, 0, -1, 0);
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 
0, -1, 0, 0, 0);
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e)<(?,?,?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, 1, 1, -1, 0, -1, -1),
 -
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -
 -            );
 -
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e) < (?,?,?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 1, 0, 0, 0, 1, 0, -1, -1),
 -                       row(0, 1, 0, 0, -1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e) <= (?,?,?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 1, 0, 0, 0, 1, 0, -1, -1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0)
 -            );
 -
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e)<=(?,?,?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, 1, 1, -1, 0, -1, -1),
 -
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c)<=(?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, -1, 0, -1, -1),
 -
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c)<(?,?) " +
 -            "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, -1, 0, -1, -1),
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e)<=(?,?,?,?) " +
 -            "AND (b)>=(?)", 0, 2, 0, 1, 1, -1),
 -
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e)<=(?,?,?,?) " +
 -            "AND (b)>(?)", 0, 2, 0, 1, 1, -1),
 -
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) <= 
(?,?,?,?)", 0, 1, 0, 0, 0),
 -                       row(0, -1, 0, 0, 0),
 -                       row(0, -1, 0, -1, 0),
 -                       row(0, 0, 0, 0, 0),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, -1, -1),
 -                       row(0, 1, -1, 1, 0),
 -                       row(0, 1, -1, 1, 1),
 -                       row(0, 1, -1, 0, 0)
 -            );
 -
 -            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) > 
(?,?,?,?)", 0, 1, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -
 -            );
 -
 -            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) >= 
(?,?,?,?)", 0, 1, 0, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d) >= 
(?,?,?)", 0, 1, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 1, 0, 0, -1),
 -                       row(0, 1, 0, 0, 0),
 -                       row(0, 1, 0, 0, 1),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d) > 
(?,?,?)", 0, 1, 0, 0),
 -                       row(0, 1, 1, 0, -1),
 -                       row(0, 1, 1, 0, 0),
 -                       row(0, 1, 1, 0, 1),
 -                       row(0, 1, 1, -1, 0),
 -                       row(0, 1, 0, 1, -1),
 -                       row(0, 1, 0, 1, 1),
 -                       row(0, 2, 0, 1, 1),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1),
 -                       row(0, 2, -3, 1, 1)
 -            );
 -
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b) < (?) ", 0, 0),
 -                       row(0, -1, 0, 0, 0), row(0, -1, 0, -1, 0)
 -            );
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b) <= (?) ", 0, -1),
 -                       row(0, -1, 0, 0, 0), row(0, -1, 0, -1, 0)
 -            );
 -            assertRows(execute(
 -            "SELECT * FROM %s" +
 -            " WHERE a = ? " +
 -            "AND (b,c,d,e) < (?,?,?,?) and (b,c,d,e) > (?,?,?,?) ", 0, 2, 0, 
0, 0, 2, -2, 0, 0),
 -                       row(0, 2, 0, -1, 0),
 -                       row(0, 2, 0, -1, 1),
 -                       row(0, 2, -1, 1, 1)
 -            );
 -        }
 +        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, 
PRIMARY KEY (a, b, c, d, e)) WITH " +
 +                    "CLUSTERING ORDER BY (b ASC, c DESC, d DESC, e ASC)");
 +
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
2, 0, -1, 0);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
2, 0, -1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
2, 0, 1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
2, -1, 1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
2, -3, 1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, -1, 0, 0);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, -1, 1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, -1, 1, 0);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, 0, 1, -1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, 0, 1, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, 0, 0, -1);
 +        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, 0, 0, 1);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
1, 0, -1, -1);
 +        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, 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, 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, 0);
 +        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, 
-1, 0, -1, 0);
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)", 0, 
-1, 0, 0, 0);
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e)<(?,?,?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, 1, 1, -1, 0, -1, -1),
 +
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +
 +        );
 +
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e) < (?,?,?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 1, 0, 0, 0, 1, 0, -1, -1),
 +                   row(0, 1, 0, 0, -1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e) <= (?,?,?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 1, 0, 0, 0, 1, 0, -1, -1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0)
 +        );
 +
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e)<=(?,?,?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, 1, 1, -1, 0, -1, -1),
 +
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c)<=(?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, -1, 0, -1, -1),
 +
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c)<(?,?) " +
 +        "AND (b,c,d,e)>(?,?,?,?)", 0, 2, 0, -1, 0, -1, -1),
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e)<=(?,?,?,?) " +
 +        "AND (b)>=(?)", 0, 2, 0, 1, 1, -1),
 +
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e)<=(?,?,?,?) " +
 +        "AND (b)>(?)", 0, 2, 0, 1, 1, -1),
 +
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) <= 
(?,?,?,?)", 0, 1, 0, 0, 0),
 +                   row(0, -1, 0, 0, 0),
 +                   row(0, -1, 0, -1, 0),
 +                   row(0, 0, 0, 0, 0),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, -1, -1),
 +                   row(0, 1, -1, 1, 0),
 +                   row(0, 1, -1, 1, 1),
 +                   row(0, 1, -1, 0, 0)
 +        );
 +
 +        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) > 
(?,?,?,?)", 0, 1, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +
 +        );
 +
 +        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d,e) >= 
(?,?,?,?)", 0, 1, 0, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d) >= 
(?,?,?)", 0, 1, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 1, 0, 0, -1),
 +                   row(0, 1, 0, 0, 0),
 +                   row(0, 1, 0, 0, 1),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute("SELECT * FROM %s WHERE a = ? AND (b,c,d) > 
(?,?,?)", 0, 1, 0, 0),
 +                   row(0, 1, 1, 0, -1),
 +                   row(0, 1, 1, 0, 0),
 +                   row(0, 1, 1, 0, 1),
 +                   row(0, 1, 1, -1, 0),
 +                   row(0, 1, 0, 1, -1),
 +                   row(0, 1, 0, 1, 1),
 +                   row(0, 2, 0, 1, 1),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1),
 +                   row(0, 2, -3, 1, 1)
 +        );
 +
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b) < (?) ", 0, 0),
 +                   row(0, -1, 0, 0, 0), row(0, -1, 0, -1, 0)
 +        );
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b) <= (?) ", 0, -1),
 +                   row(0, -1, 0, 0, 0), row(0, -1, 0, -1, 0)
 +        );
 +        assertRows(execute(
 +        "SELECT * FROM %s" +
 +        " WHERE a = ? " +
 +        "AND (b,c,d,e) < (?,?,?,?) and (b,c,d,e) > (?,?,?,?) ", 0, 2, 0, 0, 
0, 2, -2, 0, 0),
 +                   row(0, 2, 0, -1, 0),
 +                   row(0, 2, 0, -1, 1),
 +                   row(0, 2, -1, 1, 1)
 +        );
      }
  
+     @Test
+     public void testMixedOrderColumnsInReverse() throws Throwable
+     {
+         createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, b, 
c)) WITH CLUSTERING ORDER BY (b ASC, c DESC);");
+ 
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 1, 3)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 1, 2)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 1, 1)");
+ 
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 2, 3)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 2, 2)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 2, 1)");
+ 
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 3, 3)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 3, 2)");
+         execute("INSERT INTO %s (a, b, c) VALUES (0, 3, 1)");
+ 
+         assertRows(execute("SELECT b, c FROM %s WHERE a = 0 AND (b, c) >= (2, 
2) ORDER BY b DESC, c ASC;"),
+                    row(3, 1),
+                    row(3, 2),
+                    row(3, 3),
+                    row(2, 2),
+                    row(2, 3));
+     }
+ 
      /**
       * Check select on tuple relations, see CASSANDRA-8613
       * migrated from cql_tests.py:TestCQL.simple_tuple_query_test()


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

Reply via email to