diff --git a/doc/cql3/CQL.textile b/doc/cql3/CQL.textile index 1ee2537e8b..83899d2f16 100644 --- a/doc/cql3/CQL.textile +++ b/doc/cql3/CQL.textile @@ -1029,6 +1029,7 @@ bc(syntax).. FROM ( WHERE )? ( ORDER BY )? + ( PER PARTITION LIMIT )? ( LIMIT )? ( ALLOW FILTERING )? @@ -1147,9 +1148,9 @@ The @ORDER BY@ option allows to select the order of the returned results. It tak * if the table has been defined without any specific @CLUSTERING ORDER@, then then allowed orderings are the order induced by the clustering columns and the reverse of that one. * otherwise, the orderings allowed are the order of the @CLUSTERING ORDER@ option and the reversed one. -h4(#selectLimit). @LIMIT@ +h4(#selectLimit). @LIMIT@ and @PER PARTITION LIMIT@ -The @LIMIT@ option to a @SELECT@ statement limits the number of rows returned by a query. +The @LIMIT@ option to a @SELECT@ statement limits the number of rows returned by a query, while the @PER PARTITION LIMIT@ option limits the number of rows returned for a given partition by the query. Note that both type of limit can used in the same statement. h4(#selectAllowFiltering). @ALLOW FILTERING@ @@ -2315,6 +2316,7 @@ h3. 3.4.2 * "@INSERT/UPDATE options@":#updateOptions for tables having a default_time_to_live specifying a TTL of 0 will remove the TTL from the inserted or updated values * "@ALTER TABLE@":#alterTableStmt @ADD@ and @DROP@ now allow mutiple columns to be added/removed +* New "@PER PARTITION LIMIT@":#selectLimit option (see "CASSANDRA-7017":https://issues.apache.org/jira/browse/CASSANDRA-7017). h3. 3.4.1 diff --git a/src/java/org/apache/cassandra/cql3/QueryProcessor.java b/src/java/org/apache/cassandra/cql3/QueryProcessor.java index 1fd8564d99..5f4b0f67a2 100644 --- a/src/java/org/apache/cassandra/cql3/QueryProcessor.java +++ b/src/java/org/apache/cassandra/cql3/QueryProcessor.java @@ -59,7 +59,7 @@ import org.github.jamm.MemoryMeter; public class QueryProcessor implements QueryHandler { - public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.4.0"); + public static final CassandraVersion CQL_VERSION = new CassandraVersion("3.4.2"); public static final QueryProcessor instance = new QueryProcessor(); diff --git a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java index 9b68d7af05..b164e618c5 100644 --- a/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java +++ b/src/java/org/apache/cassandra/cql3/statements/SelectStatement.java @@ -857,7 +857,7 @@ public class SelectStatement implements CQLStatement isReversed, orderingComparator, prepareLimit(boundNames, limit, keyspace(), limitReceiver()), - prepareLimit(boundNames, perPartitionLimit, keyspace(), limitReceiver())); + prepareLimit(boundNames, perPartitionLimit, keyspace(), perPartitionLimitReceiver())); return new ParsedStatement.Prepared(stmt, boundNames, boundNames.getPartitionKeyBindIndexes(cfm)); } @@ -1055,6 +1055,11 @@ public class SelectStatement implements CQLStatement return new ColumnSpecification(keyspace(), columnFamily(), new ColumnIdentifier("[limit]", true), Int32Type.instance); } + private ColumnSpecification perPartitionLimitReceiver() + { + return new ColumnSpecification(keyspace(), columnFamily(), new ColumnIdentifier("[per_partition_limit]", true), Int32Type.instance); + } + @Override public String toString() {