cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject [3/4] cassandra git commit: Merge branch cassandra-3.11 into trunk
Date Thu, 15 Feb 2018 10:05:17 GMT
http://git-wip-us.apache.org/repos/asf/cassandra/blob/f74b0ea7/test/unit/org/apache/cassandra/cql3/validation/operations/SelectGroupByTest.java
----------------------------------------------------------------------
diff --cc test/unit/org/apache/cassandra/cql3/validation/operations/SelectGroupByTest.java
index c941070,5c51494..17d06ac
--- a/test/unit/org/apache/cassandra/cql3/validation/operations/SelectGroupByTest.java
+++ b/test/unit/org/apache/cassandra/cql3/validation/operations/SelectGroupByTest.java
@@@ -26,378 -26,489 +26,485 @@@ public class SelectGroupByTest extends 
      @Test
      public void testGroupByWithoutPaging() throws Throwable
      {
 -        for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" })
 -        {
 -            createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key (a, b, c, d))"
 -                    + compactOption);
 -
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 3, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 2, 3, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 4, 3, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (3, 3, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (4, 8, 2, 12, 24)");
 -
 -            // Makes sure that we have some tombstones
 -            execute("DELETE FROM %s WHERE a = 1 AND b = 3 AND c = 2 AND d = 12");
 -            execute("DELETE FROM %s WHERE a = 3");
 -
 -            // Range queries
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a"),
 -                       row(1, 2, 6, 4L, 24),
 -                       row(2, 2, 6, 2L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b"),
 -                       row(1, 2, 6, 2L, 12),
 -                       row(1, 4, 12, 2L, 24),
 -                       row(2, 2, 6, 1L, 6),
 -                       row(2, 4, 12, 1L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 GROUP BY a, b ALLOW FILTERING"),
 -                       row(1, 2, 6, 2L, 12),
 -                       row(2, 2, 6, 1L, 6));
 -
 -            assertEmpty(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE b IN () GROUP BY a, b ALLOW FILTERING"));
 -
 -            // Range queries without aggregates
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6),
 -                       row(2, 2, 3, 3),
 -                       row(2, 4, 3, 6),
 -                       row(4, 8, 2, 12));
 -
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6),
 -                       row(2, 2, 3, 3),
 -                       row(2, 4, 3, 6),
 -                       row(4, 8, 2, 12));
 -
 -            // Range queries with wildcard
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(1, 4, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 -
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 4, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 -
 -            // Range query with LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b LIMIT 2"),
 -                       row(1, 2, 6, 2L, 12),
 -                       row(1, 4, 12, 2L, 24));
 -
 -            // Range queries with PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 6, 2L, 12),
 -                       row(2, 2, 6, 1L, 6),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a PER PARTITION LIMIT 2"),
 -                       row(1, 2, 6, 4L, 24),
 -                       row(2, 2, 6, 2L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            // Range query with PER PARTITION LIMIT and LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1 LIMIT 2"),
 -                       row(1, 2, 6, 2L, 12),
 -                       row(2, 2, 6, 1L, 6));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a PER PARTITION LIMIT 2"),
 -                       row(1, 2, 6, 4L, 24),
 -                       row(2, 2, 6, 2L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            // Range queries without aggregates and with LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c LIMIT 3"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6));
 -
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b LIMIT 3"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6),
 -                       row(2, 2, 3, 3));
 -
 -            // Range queries with wildcard and with LIMIT
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b, c LIMIT 3"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(1, 4, 2, 6, 12));
 +        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key (a, b, c, d))");
 +
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 3, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 2, 3, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 4, 3, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (3, 3, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (4, 8, 2, 12, 24)");
  
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b LIMIT 3"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 4, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6));
 -
 -            // Range queries without aggregates and with PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(2, 2, 3, 3),
 -                       row(2, 4, 3, 6),
 -                       row(4, 8, 2, 12));
 -
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 1, 3),
 -                       row(2, 2, 3, 3),
 -                       row(4, 8, 2, 12));
 -
 -            // Range queries with wildcard and with PER PARTITION LIMIT
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 -
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(2, 2, 3, 3, 6),
 -                       row(4, 8, 2, 12, 24));
 -
 -            // Range queries without aggregates, with PER PARTITION LIMIT and LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(2, 2, 3, 3));
 -
 -            // Range queries with wildcard, with PER PARTITION LIMIT and LIMIT
 -            assertRows(execute("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6));
 -
 -            // Range query with DISTINCT
 -            assertRows(execute("SELECT DISTINCT a, count(a)FROM %s GROUP BY a"),
 -                       row(1, 1L),
 -                       row(2, 1L),
 -                       row(4, 1L));
 +        // Makes sure that we have some tombstones
 +        execute("DELETE FROM %s WHERE a = 1 AND b = 3 AND c = 2 AND d = 12");
 +        execute("DELETE FROM %s WHERE a = 3");
  
 -            assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 -                                 "SELECT DISTINCT a, count(a)FROM %s GROUP BY a, b");
 +        // Range queries
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a"),
 +                   row(1, 2, 6, 4L, 24),
 +                   row(2, 2, 6, 2L, 12),
 +                   row(4, 8, 24, 1L, 24));
  
 -            // Range query with DISTINCT and LIMIT
 -            assertRows(execute("SELECT DISTINCT a, count(a)FROM %s GROUP BY a LIMIT 2"),
 -                       row(1, 1L),
 -                       row(2, 1L));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b"),
 +                   row(1, 2, 6, 2L, 12),
 +                   row(1, 4, 12, 2L, 24),
 +                   row(2, 2, 6, 1L, 6),
 +                   row(2, 4, 12, 1L, 12),
 +                   row(4, 8, 24, 1L, 24));
  
 -            assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 -                                 "SELECT DISTINCT a, count(a)FROM %s GROUP BY a, b LIMIT 2");
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 GROUP BY a, b ALLOW FILTERING"),
 +                   row(1, 2, 6, 2L, 12),
 +                   row(2, 2, 6, 1L, 6));
  
 -            // Range query with ORDER BY
 -            assertInvalidMessage("ORDER BY is only supported when the partition key is restricted by an EQ or an IN",
 -                                 "SELECT a, b, c, count(b), max(e) FROM %s GROUP BY a, b ORDER BY b DESC, c DESC");
 +        assertEmpty(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE b IN () GROUP BY a, b ALLOW FILTERING"));
  
 -            // Single partition queries
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 4, 12, 2L, 24));
 +        // Range queries without aggregates
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6),
 +                   row(2, 2, 3, 3),
 +                   row(2, 4, 3, 6),
 +                   row(4, 8, 2, 12));
 +
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6),
 +                   row(2, 2, 3, 3),
 +                   row(2, 4, 3, 6),
 +                   row(4, 8, 2, 12));
  
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY b, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 4, 12, 2L, 24));
++        // Range queries with wildcard
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b, c"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(1, 4, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
+ 
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, b, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12));
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 4, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
+ 
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12));
 +        // Range query with LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b LIMIT 2"),
 +                   row(1, 2, 6, 2L, 12),
 +                   row(1, 4, 12, 2L, 24));
  
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12));
 +        // Range queries with PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
 +                   row(1, 2, 6, 2L, 12),
 +                   row(2, 2, 6, 1L, 6),
 +                   row(4, 8, 24, 1L, 24));
  
 -            // Single partition queries without aggregates
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a PER PARTITION LIMIT 2"),
 +                   row(1, 2, 6, 4L, 24),
 +                   row(2, 2, 6, 2L, 12),
 +                   row(4, 8, 24, 1L, 24));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6));
 +        // Range query with PER PARTITION LIMIT and LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1 LIMIT 2"),
 +                   row(1, 2, 6, 2L, 12),
 +                   row(2, 2, 6, 1L, 6));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY b, c"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a PER PARTITION LIMIT 2"),
 +                   row(1, 2, 6, 4L, 24),
 +                   row(2, 2, 6, 2L, 12),
 +                   row(4, 8, 24, 1L, 24));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 and token(a) = token(1) GROUP BY b, c"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6));
 +        // Range queries without aggregates and with LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c LIMIT 3"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6));
  
 -            // Single partition queries with wildcard
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(1, 4, 2, 6, 12));
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b LIMIT 3"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6),
 +                   row(2, 2, 3, 3));
  
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 4, 2, 6, 12));
++        // Range queries with wildcard and with LIMIT
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b, c LIMIT 3"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(1, 4, 2, 6, 12));
+ 
 -            // Single partition queries with DISTINCT
 -            assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a"),
 -                       row(1, 1L));
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b LIMIT 3"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 4, 2, 6, 12),
++                   row(2, 2, 3, 3, 6));
+ 
 -            assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 -                                 "SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a, b");
 +        // Range queries without aggregates and with PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(2, 2, 3, 3),
 +                   row(2, 4, 3, 6),
 +                   row(4, 8, 2, 12));
 +
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
 +                   row(1, 2, 1, 3),
 +                   row(2, 2, 3, 3),
 +                   row(4, 8, 2, 12));
  
 -            // Single partition queries with LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 10"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 4, 12, 2L, 24));
++        // Range queries with wildcard and with PER PARTITION LIMIT
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
+ 
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12));
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b PER PARTITION LIMIT 1"),
++                   row(1, 2, 1, 3, 6),
++                   row(2, 2, 3, 3, 6),
++                   row(4, 8, 2, 12, 24));
++
 +        // Range queries without aggregates, with PER PARTITION LIMIT and LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(2, 2, 3, 3));
 +
++        // Range queries with wildcard, with PER PARTITION LIMIT and LIMIT
++        assertRows(execute("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(2, 2, 3, 3, 6));
+ 
 -            assertRows(execute("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 1"),
 -                       row(1L, 6));
 +        // Range query with DISTINCT
 +        assertRows(execute("SELECT DISTINCT a, count(a)FROM %s GROUP BY a"),
 +                   row(1, 1L),
 +                   row(2, 1L),
 +                   row(4, 1L));
  
 -            // Single partition queries with PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 10"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 4, 12, 2L, 24));
 +        assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 +                             "SELECT DISTINCT a, count(a)FROM %s GROUP BY a, b");
  
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12));
 +        // Range query with DISTINCT and LIMIT
 +        assertRows(execute("SELECT DISTINCT a, count(a)FROM %s GROUP BY a LIMIT 2"),
 +                   row(1, 1L),
 +                   row(2, 1L));
  
 -            assertRows(execute("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 1"),
 -                       row(1L, 6));
 +        assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 +                             "SELECT DISTINCT a, count(a)FROM %s GROUP BY a, b LIMIT 2");
  
 -            // Single partition queries without aggregates and with LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 2"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6));
 +        // Range query with ORDER BY
 +        assertInvalidMessage("ORDER BY is only supported when the partition key is restricted by an EQ or an IN",
 +                             "SELECT a, b, c, count(b), max(e) FROM %s GROUP BY a, b ORDER BY b DESC, c DESC");
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1"),
 -                       row(1, 2, 1, 3));
 +        // Single partition queries
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 4, 12, 2L, 24));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY b, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 4, 12, 2L, 24));
  
 -            // Single partition queries with wildcard and with LIMIT
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, b, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12));
  
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1"),
 -                       row(1, 2, 1, 3, 6));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12));
  
 -            // Single partition queries without aggregates and with PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 1, 3));
 +        // Single partition queries without aggregates
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6));
  
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6));
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6));
  
 -            // Single partition queries with wildcard and with PER PARTITION LIMIT
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12));
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY b, c"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6));
  
 -            assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 1, 3, 6));
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 and token(a) = token(1) GROUP BY b, c"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6));
  
 -            // Single partition queries with ORDER BY
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC"),
 -                       row(1, 4, 24, 2L, 24),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 2, 6, 1L, 6));
++        // Single partition queries with wildcard
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(1, 4, 2, 6, 12));
+ 
 -            // Single partition queries with ORDER BY and PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC PER PARTITION LIMIT 1"),
 -                       row(1, 4, 24, 2L, 24));
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 4, 2, 6, 12));
+ 
 -            // Single partition queries with ORDER BY and LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC LIMIT 2"),
 -                       row(1, 4, 24, 2L, 24),
 -                       row(1, 2, 12, 1L, 12));
 +        // Single partition queries with DISTINCT
 +        assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a"),
 +                   row(1, 1L));
  
 -            // Multi-partitions queries
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(1, 4, 12, 2L, 24),
 -                       row(2, 2, 6, 1L, 6),
 -                       row(2, 4, 12, 1L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) AND b = 2 GROUP BY a, b, c"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(2, 2, 6, 1L, 6));
 +        assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 +                             "SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a, b");
  
 -            // Multi-partitions queries without aggregates
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 4, 2, 6),
 -                       row(2, 2, 3, 3),
 -                       row(2, 4, 3, 6),
 -                       row(4, 8, 2, 12));
 -
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 4, 2, 6),
 -                       row(2, 2, 3, 3),
 -                       row(2, 4, 3, 6),
 -                       row(4, 8, 2, 12));
 +        // Single partition queries with LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 10"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 4, 12, 2L, 24));
  
 -            // Multi-partitions with wildcard
 -            assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(1, 4, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12));
  
 -            assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 4, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 +        assertRows(execute("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 1"),
 +                   row(1L, 6));
  
 -            // Multi-partitions query with DISTINCT
 -            assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a"),
 -                       row(1, 1L),
 -                       row(2, 1L),
 -                       row(4, 1L));
 +        // Single partition queries with PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 10"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 4, 12, 2L, 24));
  
 -            assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 -                                 "SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b");
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12));
  
 -            // Multi-partitions query with DISTINCT and LIMIT
 -            assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a LIMIT 2"),
 -                       row(1, 1L),
 -                       row(2, 1L));
 +        assertRows(execute("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 1"),
 +                   row(1L, 6));
  
 -            // Multi-partitions queries with PER PARTITION LIMIT
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 1"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(2, 2, 6, 1L, 6),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 6, 1L, 6),
 -                       row(1, 2, 12, 1L, 12),
 -                       row(2, 2, 6, 1L, 6),
 -                       row(2, 4, 12, 1L, 12),
 -                       row(4, 8, 24, 1L, 24));
 -
 -            // Multi-partitions with wildcard and PER PARTITION LIMIT
 -            assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 2"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(1, 2, 2, 6, 12),
 -                       row(2, 2, 3, 3, 6),
 -                       row(2, 4, 3, 6, 12),
 -                       row(4, 8, 2, 12, 24));
 +        // Single partition queries without aggregates and with LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 2"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6));
  
 -            assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b PER PARTITION LIMIT 1"),
 -                       row(1, 2, 1, 3, 6),
 -                       row(2, 2, 3, 3, 6),
 -                       row(4, 8, 2, 12, 24));
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1"),
 +                   row(1, 2, 1, 3));
  
 -            // Multi-partitions queries with ORDER BY
 -            assertRows(execute("SELECT a, b, c, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b ORDER BY b DESC, c DESC"),
 -                       row(4, 8, 2, 1L, 24),
 -                       row(2, 4, 3, 1L, 12),
 -                       row(1, 4, 2, 2L, 24),
 -                       row(2, 2, 3, 1L, 6),
 -                       row(1, 2, 2, 2L, 12));
 -
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c ORDER BY b DESC, c DESC"),
 -                       row(4, 8, 2, 12),
 -                       row(2, 4, 3, 6),
 -                       row(1, 4, 2, 12),
 -                       row(2, 2, 3, 3),
 -                       row(1, 2, 2, 6),
 -                       row(1, 2, 1, 3));
 -
 -            // Multi-partitions queries with ORDER BY and LIMIT
 -            assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b ORDER BY b DESC, c DESC LIMIT 3"),
 -                       row(4, 8, 2, 12),
 -                       row(2, 4, 3, 6),
 -                       row(1, 4, 2, 12));
 -
 -            // Multi-partitions with wildcard, ORDER BY and LIMIT
 -            assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c ORDER BY b DESC, c DESC LIMIT 3"),
 -                       row(4, 8, 2, 12, 24),
 -                       row(2, 4, 3, 6, 12),
 -                       row(1, 4, 2, 12, 24));
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6));
  
 -            // Invalid queries
 -            assertInvalidMessage("Group by is currently only supported on the columns of the PRIMARY KEY, got e",
 -                                 "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, e");
++        // Single partition queries with wildcard and with LIMIT
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12));
+ 
 -            assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 -                                 "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY c");
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1"),
++                   row(1, 2, 1, 3, 6));
+ 
 -            assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 -                                 "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, c, b");
 +        // Single partition queries without aggregates and with PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 2"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6));
  
 -            assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 -                                 "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, a");
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1"),
 +                   row(1, 2, 1, 3));
  
 -            assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 -                                 "SELECT a, b, c, d FROM %s WHERE token(a) = token(1) GROUP BY b, c");
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6));
  
 -            assertInvalidMessage("Undefined column name clustering1",
 -                                 "SELECT a, b as clustering1, max(c) FROM %s WHERE a = 1 GROUP BY a, clustering1");
++        // Single partition queries with wildcard and with PER PARTITION LIMIT
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12));
+ 
 -            assertInvalidMessage("Undefined column name z",
 -                                 "SELECT a, b, max(c) FROM %s WHERE a = 1 GROUP BY a, b, z");
++        assertRows(execute("SELECT * FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1"),
++                   row(1, 2, 1, 3, 6));
+ 
 -            // Test with composite partition key
 -            createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key ((a, b), c, d))" + compactOption);
 +        // Single partition queries with ORDER BY
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC"),
 +                   row(1, 4, 24, 2L, 24),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 2, 6, 1L, 6));
  
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 1, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 3, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 +        // Single partition queries with ORDER BY and PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC PER PARTITION LIMIT 1"),
 +                   row(1, 4, 24, 2L, 24));
  
 -            assertInvalidMessage("Group by is not supported on only a part of the partition key",
 -                                 "SELECT a, b, max(d) FROM %s GROUP BY a");
 +        // Single partition queries with ORDER BY and LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC LIMIT 2"),
 +                   row(1, 4, 24, 2L, 24),
 +                   row(1, 2, 12, 1L, 12));
  
 -            assertRows(execute("SELECT a, b, max(d) FROM %s GROUP BY a, b"),
 -                       row(1, 2, 12),
 -                       row(1, 1, 12));
 +        // Multi-partitions queries
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(1, 4, 12, 2L, 24),
 +                   row(2, 2, 6, 1L, 6),
 +                   row(2, 4, 12, 1L, 12),
 +                   row(4, 8, 24, 1L, 24));
 +
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) AND b = 2 GROUP BY a, b, c"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(2, 2, 6, 1L, 6));
  
 -            assertRows(execute("SELECT a, b, max(d) FROM %s WHERE a = 1 AND b = 1 GROUP BY b"),
 -                       row(1, 1, 12));
 +        // Multi-partitions queries without aggregates
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 4, 2, 6),
 +                   row(2, 2, 3, 3),
 +                   row(2, 4, 3, 6),
 +                   row(4, 8, 2, 12));
 +
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
 +                   row(1, 2, 1, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 4, 2, 6),
 +                   row(2, 2, 3, 3),
 +                   row(2, 4, 3, 6),
 +                   row(4, 8, 2, 12));
 +
++        // Multi-partitions with wildcard
++        assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(1, 4, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
++
++        assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 4, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
+ 
 -            // Test with table without clustering key
 -            createTable("CREATE TABLE %s (a int primary key, b int, c int)" + compactOption);
 +        // Multi-partitions query with DISTINCT
 +        assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a"),
 +                   row(1, 1L),
 +                   row(2, 1L),
 +                   row(4, 1L));
  
 -            execute("INSERT INTO %s (a, b, c) VALUES (1, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c) VALUES (2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c) VALUES (3, 12, 24)");
 +        assertInvalidMessage("Grouping on clustering columns is not allowed for SELECT DISTINCT queries",
 +                             "SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b");
  
 -            assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 -                    "SELECT a, max(c) FROM %s WHERE a = 1 GROUP BY a, a");
 -        }
 +        // Multi-partitions query with DISTINCT and LIMIT
 +        assertRows(execute("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a LIMIT 2"),
 +                   row(1, 1L),
 +                   row(2, 1L));
 +
 +        // Multi-partitions queries with PER PARTITION LIMIT
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 1"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(2, 2, 6, 1L, 6),
 +                   row(4, 8, 24, 1L, 24));
 +
 +        assertRows(execute("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 2"),
 +                   row(1, 2, 6, 1L, 6),
 +                   row(1, 2, 12, 1L, 12),
 +                   row(2, 2, 6, 1L, 6),
 +                   row(2, 4, 12, 1L, 12),
 +                   row(4, 8, 24, 1L, 24));
 +
++        // Multi-partitions with wildcard and PER PARTITION LIMIT
++        assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 2"),
++                   row(1, 2, 1, 3, 6),
++                   row(1, 2, 2, 6, 12),
++                   row(2, 2, 3, 3, 6),
++                   row(2, 4, 3, 6, 12),
++                   row(4, 8, 2, 12, 24));
++
++        assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b PER PARTITION LIMIT 1"),
++                   row(1, 2, 1, 3, 6),
++                   row(2, 2, 3, 3, 6),
++                   row(4, 8, 2, 12, 24));
++
 +        // Multi-partitions queries with ORDER BY
 +        assertRows(execute("SELECT a, b, c, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b ORDER BY b DESC, c DESC"),
 +                   row(4, 8, 2, 1L, 24),
 +                   row(2, 4, 3, 1L, 12),
 +                   row(1, 4, 2, 2L, 24),
 +                   row(2, 2, 3, 1L, 6),
 +                   row(1, 2, 2, 2L, 12));
 +
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c ORDER BY b DESC, c DESC"),
 +                   row(4, 8, 2, 12),
 +                   row(2, 4, 3, 6),
 +                   row(1, 4, 2, 12),
 +                   row(2, 2, 3, 3),
 +                   row(1, 2, 2, 6),
 +                   row(1, 2, 1, 3));
 +
 +        // Multi-partitions queries with ORDER BY and LIMIT
 +        assertRows(execute("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b ORDER BY b DESC, c DESC LIMIT 3"),
 +                   row(4, 8, 2, 12),
 +                   row(2, 4, 3, 6),
 +                   row(1, 4, 2, 12));
 +
++        // Multi-partitions with wildcard, ORDER BY and LIMIT
++        assertRows(execute("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c ORDER BY b DESC, c DESC LIMIT 3"),
++                   row(4, 8, 2, 12, 24),
++                   row(2, 4, 3, 6, 12),
++                   row(1, 4, 2, 12, 24));
++
 +        // Invalid queries
 +        assertInvalidMessage("Group by is currently only supported on the columns of the PRIMARY KEY, got e",
 +                             "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, e");
 +
 +        assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 +                             "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY c");
 +
 +        assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 +                             "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, c, b");
 +
 +        assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 +                             "SELECT a, b, d, count(b), max(c) FROM %s WHERE a = 1 GROUP BY a, a");
 +
 +        assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 +                             "SELECT a, b, c, d FROM %s WHERE token(a) = token(1) GROUP BY b, c");
 +
 +        assertInvalidMessage("Undefined column name clustering1",
 +                             "SELECT a, b as clustering1, max(c) FROM %s WHERE a = 1 GROUP BY a, clustering1");
 +
 +        assertInvalidMessage("Undefined column name z",
 +                             "SELECT a, b, max(c) FROM %s WHERE a = 1 GROUP BY a, b, z");
 +
 +        // Test with composite partition key
 +        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key ((a, b), c, d))");
 +
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 1, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 1, 3, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 +
 +        assertInvalidMessage("Group by is not supported on only a part of the partition key",
 +                             "SELECT a, b, max(d) FROM %s GROUP BY a");
 +
 +        assertRows(execute("SELECT a, b, max(d) FROM %s GROUP BY a, b"),
 +                   row(1, 2, 12),
 +                   row(1, 1, 12));
 +
 +        assertRows(execute("SELECT a, b, max(d) FROM %s WHERE a = 1 AND b = 1 GROUP BY b"),
 +                   row(1, 1, 12));
 +
 +        // Test with table without clustering key
 +        createTable("CREATE TABLE %s (a int primary key, b int, c int)");
 +
 +        execute("INSERT INTO %s (a, b, c) VALUES (1, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c) VALUES (2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c) VALUES (3, 12, 24)");
 +
 +        assertInvalidMessage("Group by currently only support groups of columns following their declared order in the PRIMARY KEY",
 +                             "SELECT a, max(c) FROM %s WHERE a = 1 GROUP BY a, a");
      }
  
      @Test
@@@ -883,322 -1080,414 +1068,410 @@@
      @Test
      public void testGroupByWithPaging() throws Throwable
      {
 -        for (String compactOption : new String[] { "", " WITH COMPACT STORAGE" })
 +        createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key (a, b, c, d))");
 +
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 3, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 2, 3, 3, 6)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 4, 3, 6, 12)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (3, 3, 2, 12, 24)");
 +        execute("INSERT INTO %s (a, b, c, d, e) VALUES (4, 8, 2, 12, 24)");
 +
 +        // Makes sure that we have some tombstones
 +        execute("DELETE FROM %s WHERE a = 1 AND b = 3 AND c = 2 AND d = 12");
 +        execute("DELETE FROM %s WHERE a = 3");
 +
 +        for (int pageSize = 1; pageSize < 10; pageSize++)
          {
 -            createTable("CREATE TABLE %s (a int, b int, c int, d int, e int, primary key (a, b, c, d))"
 -                    + compactOption);
 -
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 1, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 2, 2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 3, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (1, 4, 2, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 2, 3, 3, 6)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (2, 4, 3, 6, 12)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (3, 3, 2, 12, 24)");
 -            execute("INSERT INTO %s (a, b, c, d, e) VALUES (4, 8, 2, 12, 24)");
 -
 -            // Makes sure that we have some tombstones
 -            execute("DELETE FROM %s WHERE a = 1 AND b = 3 AND c = 2 AND d = 12");
 -            execute("DELETE FROM %s WHERE a = 3");
 -
 -            for (int pageSize = 1; pageSize < 10; pageSize++)
 -            {
 -                // Range queries
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a", pageSize),
 -                              row(1, 2, 6, 4L, 24),
 -                              row(2, 2, 6, 2L, 12),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b", pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(1, 4, 12, 2L, 24),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(2, 4, 12, 1L, 12),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s", pageSize),
 -                              row(1, 2, 6, 7L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 GROUP BY a, b ALLOW FILTERING",
 -                                                   pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(2, 2, 6, 1L, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 ALLOW FILTERING",
 -                                                   pageSize),
 -                              row(1, 2, 6, 3L, 12));
 -
 -                // Range queries without aggregates
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(1, 4, 2, 6),
 -                              row(2, 2, 3, 3),
 -                              row(2, 4, 3, 6),
 -                              row(4, 8, 2, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 4, 2, 6),
 -                              row(2, 2, 3, 3),
 -                              row(2, 4, 3, 6),
 -                              row(4, 8, 2, 12));
 -
 -                // Range queries with wildcard
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 2, 2, 6, 12),
 -                              row(1, 4, 2, 6, 12),
 -                              row(2, 2, 3, 3, 6),
 -                              row(2, 4, 3, 6, 12),
 -                              row(4, 8, 2, 12, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 4, 2, 6, 12),
 -                              row(2, 2, 3, 3, 6),
 -                              row(2, 4, 3, 6, 12),
 -                              row(4, 8, 2, 12, 24));
 -
 -                // Range query with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(1, 4, 12, 2L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 7L, 24));
 -
 -                // Range queries with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 3", pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(1, 4, 12, 2L, 24),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(2, 4, 12, 1L, 12),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                // Range query with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1 LIMIT 2", pageSize),
 -                              row(1, 2, 6, 2L, 12),
 -                              row(2, 2, 6, 1L, 6));
 -
 -                // Range query without aggregates and with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(2, 2, 3, 3),
 -                              row(2, 4, 3, 6),
 -                              row(4, 8, 2, 12));
 -
 -                // Range queries with wildcard and with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 2, 2, 6, 12),
 -                              row(1, 4, 2, 6, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 4, 2, 6, 12),
 -                              row(2, 2, 3, 3, 6));
 -
 -                // Range queries with wildcard and with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 2, 2, 6, 12),
 -                              row(2, 2, 3, 3, 6),
 -                              row(2, 4, 3, 6, 12),
 -                              row(4, 8, 2, 12, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(2, 2, 3, 3, 6),
 -                              row(4, 8, 2, 12, 24));
 -
 -                // Range queries without aggregates and with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(1, 4, 2, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 4, 2, 6),
 -                              row(2, 2, 3, 3));
 -
 -                // Range query without aggregates, with PER PARTITION LIMIT and with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(2, 2, 3, 3));
 -
 -                // Range queries with wildcard, with PER PARTITION LIMIT and LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3", pageSize),
 -                              row(1, 2, 1, 3, 6),
 -                              row(1, 2, 2, 6, 12),
 -                              row(2, 2, 3, 3, 6));
 -
 -                // Range query with DISTINCT
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s GROUP BY a", pageSize),
 -                              row(1, 1L),
 -                              row(2, 1L),
 -                              row(4, 1L));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s", pageSize),
 -                              row(1, 3L));
 -
 -                // Range query with DISTINCT and LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s GROUP BY a LIMIT 2", pageSize),
 -                              row(1, 1L),
 -                              row(2, 1L));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s LIMIT 2", pageSize),
 -                              row(1, 3L));
 -
 -                // Range query with ORDER BY
 -                assertInvalidMessage("ORDER BY is only supported when the partition key is restricted by an EQ or an IN",
 -                                     "SELECT a, b, c, count(b), max(e) FROM %s GROUP BY a, b ORDER BY b DESC, c DESC");
 -
 -                // Single partition queries
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(1, 4, 12, 2L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1", pageSize),
 -                              row(1, 2, 6, 4L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, b, c",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 2L, 12));
 -
 -                // Single partition queries without aggregates
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 4, 2, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c", pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(1, 4, 2, 6));
 -
 -                // Single partition queries with wildcard
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 2, 2, 6, 12),
 -                           row(1, 4, 2, 6, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 4, 2, 6, 12));
 -
 -                // Single partition query with DISTINCT
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a",
 -                                                   pageSize),
 -                              row(1, 1L));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a",
 -                                                   pageSize),
 -                              row(1, 1L));
 -
 -                // Single partition queries with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 10",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(1, 4, 12, 2L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 4L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 1",
 -                                                   pageSize),
 -                              row(1L, 6));
 -
 -                // Single partition queries with wildcard and with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 2, 2, 6, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1", pageSize),
 -                           row(1, 2, 1, 3, 6));
 -
 -                // Single partition queries with wildcard and with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 2, 2, 6, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
 -                           row(1, 2, 1, 3, 6));
 -
 -                // Single partition query with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12));
 -
 -                // Single partition queries without aggregates and with LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 4, 2, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1",
 -                                                   pageSize),
 -                              row(1, 2, 1, 3));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6));
 -
 -                // Single partition queries with ORDER BY
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC",
 -                                                   pageSize),
 -                              row(1, 4, 24, 2L, 24),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(1, 2, 6, 1L, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 ORDER BY b DESC, c DESC",
 -                                                   pageSize),
 -                              row(1, 4, 24, 4L, 24));
 -
 -                // Single partition queries with ORDER BY and LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 4, 24, 2L, 24),
 -                              row(1, 2, 12, 1L, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 ORDER BY b DESC, c DESC LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 4, 24, 4L, 24));
 -
 -                // Single partition queries with ORDER BY and PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC PER PARTITION LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 4, 24, 2L, 24),
 -                              row(1, 2, 12, 1L, 12));
 -
 -                // Multi-partitions queries
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(1, 4, 12, 2L, 24),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(2, 4, 12, 1L, 12),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4)",
 -                                                   pageSize),
 -                              row(1, 2, 6, 7L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) AND b = 2 GROUP BY a, b, c",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(2, 2, 6, 1L, 6));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) AND b = 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 3L, 12));
 -
 -                // Multi-partitions queries with PER PARTITION LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(1, 2, 12, 1L, 12),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(2, 4, 12, 1L, 12),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c PER PARTITION LIMIT 1",
 -                                                   pageSize),
 -                              row(1, 2, 6, 1L, 6),
 -                              row(2, 2, 6, 1L, 6),
 -                              row(4, 8, 24, 1L, 24));
 -
 -                // Multi-partitions queries without aggregates
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b",
 -                                                   pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 4, 2, 6),
 -                              row(2, 2, 3, 3),
 -                              row(2, 4, 3, 6),
 -                              row(4, 8, 2, 12));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c",
 -                                                   pageSize),
 -                              row(1, 2, 1, 3),
 -                              row(1, 2, 2, 6),
 -                              row(1, 4, 2, 6),
 -                              row(2, 2, 3, 3),
 -                              row(2, 4, 3, 6),
 -                              row(4, 8, 2, 12));
 -
 -                // Multi-partitions with wildcard
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b, c", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 2, 2, 6, 12),
 -                           row(1, 4, 2, 6, 12),
 -                           row(2, 2, 3, 3, 6),
 -                           row(2, 4, 3, 6, 12),
 -                           row(4, 8, 2, 12, 24));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a IN (1, 2, 4) GROUP BY a, b", pageSize),
 -                           row(1, 2, 1, 3, 6),
 -                           row(1, 4, 2, 6, 12),
 -                           row(2, 2, 3, 3, 6),
 -                           row(2, 4, 3, 6, 12),
 -                           row(4, 8, 2, 12, 24));
 -
 -                // Multi-partitions queries with DISTINCT
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a",
 -                                                   pageSize),
 -                              row(1, 1L),
 -                              row(2, 1L),
 -                              row(4, 1L));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4)",
 -                                                   pageSize),
 -                              row(1, 3L));
 -
 -                // Multi-partitions query with DISTINCT and LIMIT
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) GROUP BY a LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 1L),
 -                              row(2, 1L));
 -
 -                assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a IN (1, 2, 4) LIMIT 2",
 -                                                   pageSize),
 -                              row(1, 3L));
 -            }
 +            // Range queries
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a", pageSize),
 +                          row(1, 2, 6, 4L, 24),
 +                          row(2, 2, 6, 2L, 12),
 +                          row(4, 8, 24, 1L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b", pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(1, 4, 12, 2L, 24),
 +                          row(2, 2, 6, 1L, 6),
 +                          row(2, 4, 12, 1L, 12),
 +                          row(4, 8, 24, 1L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s", pageSize),
 +                          row(1, 2, 6, 7L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 GROUP BY a, b ALLOW FILTERING",
 +                                               pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(2, 2, 6, 1L, 6));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE b = 2 ALLOW FILTERING",
 +                                               pageSize),
 +                          row(1, 2, 6, 3L, 12));
 +
 +            // Range queries without aggregates
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6),
 +                          row(1, 4, 2, 6),
 +                          row(2, 2, 3, 3),
 +                          row(2, 4, 3, 6),
 +                          row(4, 8, 2, 12));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 4, 2, 6),
 +                          row(2, 2, 3, 3),
 +                          row(2, 4, 3, 6),
 +                          row(4, 8, 2, 12));
 +
++            // Range queries with wildcard
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 2, 2, 6, 12),
++                          row(1, 4, 2, 6, 12),
++                          row(2, 2, 3, 3, 6),
++                          row(2, 4, 3, 6, 12),
++                          row(4, 8, 2, 12, 24));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 4, 2, 6, 12),
++                          row(2, 2, 3, 3, 6),
++                          row(2, 4, 3, 6, 12),
++                          row(4, 8, 2, 12, 24));
++
 +            // Range query with LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(1, 4, 12, 2L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 7L, 24));
 +
 +            // Range queries with PER PARTITION LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 3", pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(1, 4, 12, 2L, 24),
 +                          row(2, 2, 6, 1L, 6),
 +                          row(2, 4, 12, 1L, 12),
 +                          row(4, 8, 24, 1L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(2, 2, 6, 1L, 6),
 +                          row(4, 8, 24, 1L, 24));
 +
 +            // Range query with PER PARTITION LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s GROUP BY a, b PER PARTITION LIMIT 1 LIMIT 2", pageSize),
 +                          row(1, 2, 6, 2L, 12),
 +                          row(2, 2, 6, 1L, 6));
 +
 +            // Range query without aggregates and with PER PARTITION LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6),
 +                          row(2, 2, 3, 3),
 +                          row(2, 4, 3, 6),
 +                          row(4, 8, 2, 12));
 +
 +            // Range queries without aggregates and with LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c LIMIT 3", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6),
 +                          row(1, 4, 2, 6));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b LIMIT 3", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 4, 2, 6),
 +                          row(2, 2, 3, 3));
 +
 +            // Range query without aggregates, with PER PARTITION LIMIT and with LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6),
 +                          row(2, 2, 3, 3));
 +
++            // Range queries with wildcard and with LIMIT
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c LIMIT 3", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 2, 2, 6, 12),
++                          row(1, 4, 2, 6, 12));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b LIMIT 3", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 4, 2, 6, 12),
++                          row(2, 2, 3, 3, 6));
++
++            // Range queries with wildcard and with PER PARTITION LIMIT
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 2, 2, 6, 12),
++                          row(2, 2, 3, 3, 6),
++                          row(2, 4, 3, 6, 12),
++                          row(4, 8, 2, 12, 24));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(2, 2, 3, 3, 6),
++                          row(4, 8, 2, 12, 24));
++
++            // Range queries with wildcard, with PER PARTITION LIMIT and LIMIT
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s GROUP BY a, b, c PER PARTITION LIMIT 2 LIMIT 3", pageSize),
++                          row(1, 2, 1, 3, 6),
++                          row(1, 2, 2, 6, 12),
++                          row(2, 2, 3, 3, 6));
++
 +            // Range query with DISTINCT
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s GROUP BY a", pageSize),
 +                          row(1, 1L),
 +                          row(2, 1L),
 +                          row(4, 1L));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s", pageSize),
 +                          row(1, 3L));
 +
 +            // Range query with DISTINCT and LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s GROUP BY a LIMIT 2", pageSize),
 +                          row(1, 1L),
 +                          row(2, 1L));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s LIMIT 2", pageSize),
 +                          row(1, 3L));
 +
 +            // Range query with ORDER BY
 +            assertInvalidMessage("ORDER BY is only supported when the partition key is restricted by an EQ or an IN",
 +                                 "SELECT a, b, c, count(b), max(e) FROM %s GROUP BY a, b ORDER BY b DESC, c DESC");
 +
 +            // Single partition queries
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c",
 +                                               pageSize),
 +                          row(1, 2, 6, 1L, 6),
 +                          row(1, 2, 12, 1L, 12),
 +                          row(1, 4, 12, 2L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1", pageSize),
 +                          row(1, 2, 6, 4L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2 GROUP BY a, b, c",
 +                                               pageSize),
 +                          row(1, 2, 6, 1L, 6),
 +                          row(1, 2, 12, 1L, 12));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 AND b = 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 2L, 12));
 +
 +            // Single partition queries without aggregates
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 4, 2, 6));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c", pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6),
 +                          row(1, 4, 2, 6));
 +
++            // Single partition queries with wildcard
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c", pageSize),
++                       row(1, 2, 1, 3, 6),
++                       row(1, 2, 2, 6, 12),
++                       row(1, 4, 2, 6, 12));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b", pageSize),
++                       row(1, 2, 1, 3, 6),
++                       row(1, 4, 2, 6, 12));
++
 +            // Single partition query with DISTINCT
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a",
 +                                               pageSize),
 +                          row(1, 1L));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT DISTINCT a, count(a)FROM %s WHERE a = 1 GROUP BY a",
 +                                               pageSize),
 +                          row(1, 1L));
 +
 +            // Single partition queries with LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 10",
 +                                               pageSize),
 +                          row(1, 2, 6, 1L, 6),
 +                          row(1, 2, 12, 1L, 12),
 +                          row(1, 4, 12, 2L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 1L, 6),
 +                          row(1, 2, 12, 1L, 12));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 4L, 24));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 1",
 +                                               pageSize),
 +                          row(1L, 6));
 +
 +            // Single partition query with PER PARTITION LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 6, 1L, 6),
 +                          row(1, 2, 12, 1L, 12));
 +
 +            // Single partition queries without aggregates and with LIMIT
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 4, 2, 6));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1",
 +                                               pageSize),
 +                          row(1, 2, 1, 3));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, c, d FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2",
 +                                               pageSize),
 +                          row(1, 2, 1, 3),
 +                          row(1, 2, 2, 6));
 +
++            // Single partition queries with wildcard and with LIMIT
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c LIMIT 2", pageSize),
++                       row(1, 2, 1, 3, 6),
++                       row(1, 2, 2, 6, 12));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b LIMIT 1", pageSize),
++                       row(1, 2, 1, 3, 6));
++
++            // Single partition queries with wildcard and with PER PARTITION LIMIT
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b, c PER PARTITION LIMIT 2", pageSize),
++                       row(1, 2, 1, 3, 6),
++                       row(1, 2, 2, 6, 12));
++
++            assertRowsNet(executeNetWithPaging("SELECT * FROM %s WHERE a = 1 GROUP BY a, b PER PARTITION LIMIT 1", pageSize),
++                       row(1, 2, 1, 3, 6));
++
 +            // Single partition queries with ORDER BY
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 GROUP BY a, b, c ORDER BY b DESC, c DESC",
 +                                               pageSize),
 +                          row(1, 4, 24, 2L, 24),
 +                          row(1, 2, 12, 1L, 12),
 +                          row(1, 2, 6, 1L, 6));
 +
 +            assertRowsNet(executeNetWithPaging("SELECT a, b, e, count(b), max(e) FROM %s WHERE a = 1 ORDER B

<TRUNCATED>

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


Mime
View raw message